| You are not logged in. Login Now | register | search | |||||||||
|
| |||
| Author | Message | ||
|
tlk |
Hey there people, Sorry, maybe it's noobish but that could be right because im new here. Could anyone tell me how to chmod files? I am following this tutorial: http://www.happyhacker.org/gtmhh/shella3.shtml to learn and learn. So, could anyone help me? Thanks | ||
| 15 responses total. | |||
|
keesan |
chmod +x filename - makes a file executable by anyone. You can probably find lots of information about chmod on the web with a search engine, in simpler language than the manual (man) pages. (or does +x make is executable only by root? I am always root). | ||
|
nharmon |
chmod g+x gives the group execute permission.
chmod o+r gives the owner read permission.
chmod 755 gives the owner read/write/execute permission, while only
giving read and execute permission to the group and
everybody else.
Chmodding is something you gotta read about to do it. Can't really be
shown.
| ||
|
cross |
This would be better in the Unix conference, but.... chmod +x makes a file executable by anyway. Unix file permissions work like this: There are three separate permission bits: Read, Write, and Execute. These are replicated for three separate classes of users: The user who owns the file, the *group* that `owns' the file, and everybody else. The chmod bit changese these permission bits. (There are a few others, but we needn't go into them right now). You may either specify permissions symbolically, or in octal. In the latter, you use numbers to specify what the permissions should be. You usually give a three digit number that specifies read, write, and execute for user, group, and world all at once. 04 is read, 02 is write, and 01 is execute. You add these together to get what permissions you want. So, 04 + 02 = 06 is read and write. 04 + 02 + 01 = 07 is read, write, and execute. 04 + 01 = 05 is read and execute. You then give three digits, so 755 is read, write, and execute for user, and read and execute for both group and other. To apply these to a file, you would type, e.g., `chmod 755 file'. In the symbolic system, permission bits are represented by letters, `r' for read, `w' for write, and `x' for execute. You use `+' or `-' to set. E.g., `chmod +x file' adds execute permissions for everybody while, `chmod -x file' removes them. Similarly for `chmod +r file', `chmod -r file', `chmod +w file' and `chmod -w file'. You can combine these in an obvious way to set multiple bits at once. E.g, `chmod +rx file' to make the file readable and executable at once. Note that in the octal system, all permissions are set at once. In the symbolic system, you modify permissions. So, if a file is writable, doing `chmod +x file' doesn't make it *unwritable* whereas, `chmod 111 file' does. Octal sets permissions absolutely, symbolic modifies them. You can also change permissions for group or owner individually in the symbolic system. For instance, `chmod u+w file' makes the file writable by the user, but doesn't affect anything else. `chmod go-w file' makes it *unwritable* by group and other (note that `o' stands for `other' not `owner,' and similarly, `u' is for `user'). There's also the `=' system of doing things, which sets bits absolutely in the symbolic system, but this should be enough to get you started. | ||
|
keesan |
Is there a linux equivalent of attr +r - to make a file unerasable by accident? | ||
|
kingjon |
I'm not on my Linux system now, but I believe it's chattr +i (for "immutable"). (Finding some such files that you didn't put there is a nearly-sure sign that you've been hacked.) | ||
|
mcnally |
re #4: > Is there a linux equivalent of attr +r - to make a file unerasable > by accident? Deleting a file in Unix is actually an operation on the containing directory and not on the file itself, so there's no way I know of (using normal Unix file permissions) to do that on a per-file basis. If you have trouble with deleting stuff accidentally you can prevent some of it by aliasing your rm, mv, and cp commands to include the -i flag. | ||
|
keesan |
Can you make an entire directory non-erasable? | ||
|
kingjon |
A directory (in *nix, anyway) is just a special kind of file, so you can use the same procedure you would on any other kind of file. | ||
|
cross |
Check the man page for the `chflags' command. | ||
|
naftee |
CHFAGS<> AH | ||
|
remmers |
Re #9: Ah, thanks. I seemed to recall that OpenBSD had some sort of extended file attribute support but didn't remember how to access it. In particular, "chflags uchg FILE" makes FILE "immutable", which seems to mean undeletable and uneditable (even if the file and its directory have write permission set). "ls -lo" lists the extended attributes. | ||
|
spooked |
To the best of my knowledge and quick googling: The chflags is available on BSD (i.e. main ones being FreeBSD, NetBSD, and OpenBSD) systems and Mac OS X (i.e. Darwin) kernels. Similar functionality on Linux is available via the chattr command, assuming your filesystems are ext2 or ext3. Windows filesystems do NOT, surprisingly, support tagging files as immutable via their ACL mechanism. Nor do Solaris/Trusted Solaris (being phased out)/Solaris 10 with Solaris Trusted Extensions via RBAC. | ||
|
naftee |
unlucky | ||
|
triludaa |
totally wrong place for this item, however, a totally good item. i'd say best item besides idle killer coop has ever offered. | ||
|
jesuit |
TROGG IS DAVID BLAINE | ||
|
Response Not Possible: You are Not Logged In |
- Backtalk version 1.3.30 - Copyright 1996-2006, Jan Wolter and Steve Weiss