chmod (short for change mode) is a Linux / Unix command used to change permissions of files and directories.

learn more… | top users | synonyms

141
votes
6answers
91k views

How to chmod 755 all directories but no file (recursively)?

How to chmod 755 all directories but no file (recursively) ? Inversely, how to chmod only files (recursively) but no directory ?
42
votes
3answers
12k views

Using Cygwin in Windows 8, chmod 600 does not work as expected?

I'm trying to change the the permissions to my key file key.pem in Cygwin 1.7.11. It has the permissions flags: -rw-rw---- chmod -c 600 key.pem Reports: mode of 'key.pem' changed from 0660 ...
22
votes
4answers
10k views

How to remove executable bit recursively from files (not directories)

When I plug-in an USB stick (FAT) into my Mac or Ubuntu machine, all files have the executable bits set. After having copied the directory structure to my hard disk how do I remove the executable bits ...
18
votes
5answers
25k views

What is the meaning of “chmod 666”?

I am using Linux. What is the meaning of chmod 666?
17
votes
2answers
27k views

Allow specific user permission to read/write my folder

I have a folder /home/samantha/folder that I want to share with the user tom. He can read/write the folder. How do I do that? chown wouldn't do it because I still want to be able to be the owner of ...
15
votes
4answers
20k views

Find all files on server with 777 permissions

I'm looking for a Linux command to go through all the directories on my server and find all files with 777 permission. The output would be a list of all those files with full path.
14
votes
3answers
12k views

How to chmod and chown hidden files in Linux?

How do I recursively execute chmod or chown for hidden files? sudo chmod -R 775 * does not work on hidden files. The same thing goes for sudo chown -R user:group.
9
votes
4answers
3k views

Chmod files to recursively give group same permissions as user

Is there a unix command to give the group the same permissions as the user currently has on a file-by-file basis recursively for a directory tree? I.e. if a file is user writeable it should become ...
9
votes
0answers
9k views

what is the @ after the permissions for in ls -l on a mac? [duplicate]

Possible Duplicate: ls -la symbolics… what does that last symbol mean? Consider the following output from ls -l on OS X 10.5.8 drwxr-xr-x 3 user staff 102 Aug 26 20:21 ...
8
votes
5answers
11k views

sudo chmod -R 777 /

sudo chmod -R 777 / I did this. It was a mistake. Is there any way to undo it? Basically it's messed up more things than I can list. I don't have time-machine enabled on my mac.
8
votes
3answers
60k views

Chmod to allow read and write permissions for directory

I have created directories in root. I am looking for the chmod command to allow all users read and write permissions to a specific directory. I have done chmod 775 for a file but I need this for a ...
8
votes
3answers
5k views

Git chmod problem: Checkout screws exec bit

Under Ubuntu and Debian the last committed files are getting the execution bit set, when I try a checkout afterwards. It's quite strange and driving me nuts: $ ls -l file -rw-r--r-- ... file # on ...
7
votes
6answers
16k views

Equivalent of chmod to change file permissions in Windows

Is there any Windows equivalent of Linux's chmod to change the permissions of a file?
6
votes
4answers
40k views

Can't change permission/ownership/group of external hard drive on Ubuntu

I have an external hard drive connected to my Linux box. I wanted to setup a web server to access files on it, but the permission on all files and directories on the drive are rwx for the owner which ...
6
votes
5answers
15k views

How to reset folder permissions to their default in Ubuntu 9.10?

I recently typed the command sudo chmod 777 -R / after that some things like sudo -i are not working normally. So I am wondering if there is any way I could reset the folder permissions to their ...
6
votes
2answers
8k views

Setting differing ACLs on directories and files

Quick ACL question: I want to set up default permissions for a file share so that everyone can rwx all of the directories and so that all newly created files are rw. Everyone who is accessing this ...
6
votes
3answers
7k views

How to set default permissions for files moved or copied to a directory?

My question is similar to How to set the default file permissions on ALL newly created files in linux - but differs in important ways: I want all files created in (or copied to or moved to) a certain ...
5
votes
2answers
5k views

How can I do a recursive chmod only on directories?

I want to change permissions on a tree on Centos 4 to add execute permissions for all directories recursively from a directory. If I use normal chmod, files other than directories are also modified: ...
5
votes
7answers
2k views

“chown -R root /” how screwed am I?

I accidentally performed the command chown -R root / while trying to change the permissions to the public folder of my rails app. I believed this changed the permissions to all my folders on the / ...
5
votes
2answers
138 views

What is this hidden directory doing on my Desktop?

On my Mac I just encountered a hidden directory on my desktop. I don't recall putting it there. When I type ls -la in Terminal on the desktop I get the following: The last folder is what triggered ...
4
votes
2answers
453 views

How to add +x just for user with chmod?

chmod +x file changes a file from rw-r--r-- to rwxr-x-r-x but really I only wanted rwx-r--r-- is this possible?
4
votes
1answer
403 views

Can I, as a user, change the default chmod settings for my account?

I work in a shared computing environment and the default setting is r-x for group and others; it's upto the users to change this. I can chmod and change the permissions for all the files. However any ...
4
votes
5answers
1k views

Standard way to duplicate a file's permissions

I am trying to find a standard POSIX way to duplicate one file's permissions to another file. On a GNU system this is easy: [alexmchale@bullfrog ~]$ ls -l hardcopy.* -rw-r--r-- 1 alexmchale users ...
3
votes
2answers
15k views

How to chown/chmod all files in current directory?

I am trying to change the ownership and permissions of some files (and directories) in the current directory. I tried this: chown username:groupname . ...expecting that it would affect all the ...
3
votes
4answers
7k views

chmod 777: how to make all files become “RWX”

I want to change permission of each files in a directory. I've been using chmod 777 but its wasting time if I have 50 files. How to make all files inside directory become rwx without change them one ...
3
votes
2answers
220 views

chmod problems with setting others to read

I have a directory tree with the permission for others as none. I need to change it to read. I execute this command: chmod -R o+r My\ Dir However, it doesn't seem to work for directories, as ...
3
votes
2answers
505 views

I accidentally chmodded the file system root - how can I revert this?

I am using Ubuntu 11.04. I mistyped and wrote sudo chmod 444 / instead of writing /home. Everything went blank and icons started disappearing, and now when I try to run Ubuntu, it hangs on the ...
3
votes
4answers
7k views

Ubuntu: default access mode (permissions) for users home dir (/home/user)

What is a default access mode (e.g. 0755) for users home dirs in Ubuntu (e.g. what is output of ls -ld /home/*)? In other major linux distribs (Debian, RedHat, Gentoo, Arch)? How can I change this ...
3
votes
2answers
454 views

I don't fully understand CHMOD file permissions, can anyone better explain it?

I've searched the internet for some time for a good explanation of CHMOD, but have yet to come by a good explanation, since every explanation uses the same words with small variations. What I know so ...
3
votes
1answer
793 views

chmod'ing file on exFAT

Is it possible to chmod a file on an exFAT formatted drive? I'm on Mac OS X and I would like to set the permissions to not be 777. Is this possible? What I'm really trying to do is set the ...
3
votes
3answers
127 views

linux permission conflicts

I'd like to ask you something that's bothering me for the last couple of days. On my system I keep a folder called myscripts under my usual home folder. What I tried to do is chmod 500 myscripts ...
3
votes
3answers
3k views

“chmod” doesn't want to work

I wrote a /bash script and to execute it I decided to set all the rights, so I tried chmod 777 * //I had 3 text files in the directory, so that's ok Then to check the result I typed ls -l But ...
3
votes
2answers
317 views

Restoring lost group permissions on mac

Using mac's terrible file sharing prefs, I managed to goof up permissions on my Documents directory. My non-Documents directories have permissions like this: drwx------+ for . drwxr-xr-x+ for .. ...
3
votes
1answer
662 views

Do I have to chmod after ln -s?

After I create a symlink with 'ln -s' (in Ubuntu 12.04, as root), it seems to be created with 777 permissions. Is that normal? Should I always do 'chmod 644' after doing 'ln -s'?
3
votes
1answer
299 views

How to chmod in Nautilus via keyboard?

I like to use the mouse as little as possible, but I find Nautilus useful enough to use it when browsing for files. If I want to rename a file while in Nautilus I can hit the F2 key; is there a way I ...
3
votes
1answer
2k views

icacls is giving access denied on remote file system

I am working on remote drive mounted on my system where i created some file i need to set some permission for that file. I used icacls but its not working. When i am trying to access file permission ...
3
votes
1answer
376 views

chmod always unsets setgid bit on directories if I'm not in a group

Here's the scenario: I'm using Ubuntu Linux (12.10, if it matters), and I've got a directory whose permissions are thus: drwxrws--- paul www-data myfolder/ You can see the setgid bit is set. If ...
3
votes
1answer
1k views

Permanently changing permission of FireWire device

I just setup a FireWire audio interface. Everything works fine, except for I need rw-rw-rw- permissions on /dev/fw0. I can always sudo chmod 666 /dev/fw0 just before setting the thing up, but then it ...
2
votes
2answers
4k views

How to fix /etc/ folder on Mac OS X

I was following a tutorial which had this command to create a launchd.conf file in /etc/ sudo echo "some command" > /etc/launchd.conf But it wouldn't work, I got permission denied after entering ...
2
votes
3answers
1k views

Do I correctly understand permission to directories in Linux/Unix?

Do I correctly understand permission to directories in Linux/Unix? If your directory has only r (read) permission you are allowed to see the content of the directory (which files are located there) ...
2
votes
3answers
672 views

difference between chmod 777 and chmod 007

What is the difference between chmod 777 and chmod 007? if 'others' means everyone, doesn't that strongly suggest the truth that chmod 777 = chmod 007?
2
votes
1answer
4k views

Chmod 755 and 751

Doing chomod 755 on a directory gives me drwxr-xr-x. Should it not give me drwxr-xr-xr since 5 is read,execute? And Doing chmod 751 on a directory give me drwxr-x--x. Should that not give me ...
2
votes
4answers
27k views

Setting permissions for specific user and groups in Linux

How can I grant permission for files to a specific user or a specific group? We have three groups: "g12" ("u1" and "u2), "g34" and "g56". g12 - should only read the file. g34 - should write and ...
2
votes
2answers
801 views

chmod: Set files to different permissions from directories

Is there away that I can run chmod to set the folders at 0755 and the files at 0644, or do I have to apply 0755 to all folders individually?
2
votes
4answers
4k views

Fixing/Correcting OS X home folder file permissions

Long story short, I managed to muck up the file permissions within my home directory in OS X (Lion). While I'm familiar enough with linux file permissions and more than comfortable changing them, I ...
2
votes
1answer
809 views

chmod does not change file permissions

I am trying to create an executable "Hello World" ruby file and I copied an existing, working executable "Hello World" ruby file and renamed it, but the new file does not have any executable ...
2
votes
2answers
82 views

How do I change permissions on a directory

I'm using CentOS and I would like to know how to change permissions on a folder with multiple files in it. I have used the following commands on the folder as root (Let's say folder =A) : chmod ...
2
votes
3answers
701 views

What does the 3 mean in drwxrwsr-x 3

I'm following directions on configuring Dovecot MDA and the instructions are telling me that /var/mail should have the following permissions: drwxrwsr-x 2 root mail When I ran ls -ld /var/mail the ...
2
votes
3answers
1k views

Deleting a chmod 0 file without superuser rights?

A PHP script accidentially changed the right flags (chmod) of a directory to 0. (No access to anybody, including owner). If I have no root access to this server, is it possible to delete the file ...
2
votes
1answer
763 views

Making a program always run as root in OS X

I'm trying to make a C program run always as root, no matter who is calling it. Basically, I want it to invoke "mkdir /test" as an example. So I created the C program as follows: #include ...