The chmod tag has no wiki summary.
23
votes
3answers
2k views
How to recover from a chmod 000 /bin ?
And now I am unable to chmod it back.. or use any of my other system programs. Luckily this is on a VM I've been toying with, but is there any way to resolve this? The system is Ubuntu Server 12.10.
...
21
votes
8answers
2k views
Why use `chmod 644` instead of `chmod u=rw,go=r,…`?
I've been working on *nix for a few years now, and one of the things I just can't get used to is octal permissions in code. Is there some other reason than line length to prefer chmod 644 ... over ...
13
votes
2answers
1k views
How to apply recursively chmod directories without affecting files?
After I apply chmod -R to a directory, permissions are changed for everything within (files and directories). How can I add execute/search (x) permissions to directories without modifying the files?
11
votes
3answers
1k views
I accidentally chmod -R +x on a directory. How do I restore the correct permissions?
Well, to be specific, it was chmod -R 755. Now every file is executable, which I don't want.
I am thinking that I should look at the first two bytes of each file for the #!, but will this cover ...
10
votes
4answers
2k views
Wrongly set chmod / 777. Problems?
I was trying to run chmod -R 777 ./ but ended up typing chmod -R 777 / and set 777 on my entire machine. What can go wrong? How can I fix it?
10
votes
1answer
2k views
What is the first chmod octal digit in a four-digit value for?
Sometimes I see chmod commands that use four octal digits instead of three -- what is the optional first digit for? For example, chmod 777 is equivalent to chmod a+rwx; what's the same command for ...
7
votes
2answers
489 views
How are file permissions calculated?
Using chmod I could set the permissions for a file, but if the parent ( .. ) directory had conflicting permissions, what would happen?
And if I create a new file, using touch or something similiar, ...
6
votes
2answers
19k views
Recursive chmod only folders or only files via script or nautilus menu?
This has been discussed before here.
What I'd like to know is how to turn these:
Recursive chmod only files within this folder:
find . -type f -exec chmod 0600 {} \;
Recursive chmod only folders ...
6
votes
4answers
559 views
When does chmod fail?
Under what circumstances will chmod fail?
I looked at the man page but it only specifies usage and doesn't go into details about what circumstances it won't work in.
I'd assume chmod will work if:
...
5
votes
4answers
3k views
Is there a web based converter between rwx and the octal version?
I can never remember what the conversion is from something like rw-r--r-- to 644. Is there a simple web based converter between the 2?
5
votes
4answers
822 views
recursively chmod
I was trying to chmod folders and files with:
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
But I was wondering:
How to do it in one line using find and excluding the ...
5
votes
2answers
242 views
vim: create file with +x bit
Is there any way to set +x bit on script while creating?
For example I run:
vim -some_option_to_make_file_executable script.sh
and after saving I can run file without any additional movings.
ps. ...
5
votes
1answer
2k views
NTFS under linux
I'm having some doubts about how to install and allow linux to correctly read/write to a NTFS formated harddrive used as backup of various machines (windows included, that's how I need NTFS).
For now ...
5
votes
1answer
485 views
Can't get directory listing of folder I have permissions to
I was having some permission problems and used the following command on directory Media:
chmod -R ugo+r Media
It didn't help so then I did:
chmod -R 775 Media
Now I get this error when I try to ...
4
votes
4answers
872 views
Is chmod behavior wrong for symlinks?
Recently we had a problem on a Red Hat Linux box with many users: the /usr/bin/sudo binary has lost its sticky bit. Work was blocked until root user fix it (we need sudo for deploying and testing).
...
4
votes
2answers
1k views
Why can't I run programs on another partition in Linux?
So for convenience, I store all my data on my Windows partition so that I can access my data easily from both Linux and Windows. However, I tried compiling a C++ program with g++, and found out that I ...
4
votes
3answers
1k views
Write access without read access
Is it possible for a user to have a write access to a file and not be able to read it? How is it possible?
I tried the following commands:
debianbox@debian:~/posix/io$ touch filetest
...
4
votes
2answers
1k views
If I change permissions on a tar file, will that apply to the files inside it?
I have a script that runs regularly via cron, that creates a tar.gz file for the purpose of backing up a directory.
For reasons beyond my control, the only user who can execute the script via cron is ...
4
votes
1answer
562 views
what is the difference between “chmod 775” and “chmod 2755”?
Question
What is the difference between "chmod 775" and "chmod 2755" ?
4
votes
2answers
1k views
Get the chmod numerical value for a file
In FreeBSD and also in Linux, how can I get the numerical chmod value of a file? For example, 644 instead of -rw-r--r--? I need an automatic way for a Bash script.
4
votes
2answers
173 views
Directory special permission problem
When I write:
chmod g=rws,u=rwx,o=rx folder_name
I get:
drwxrwSr-x
But S is not the same as s, right?
4
votes
2answers
151 views
Is it possible to represent the +X symbolic permission with an octal value?
Is it possible to represent the +X symbolic permission with an octal value? The chmod(1) man page says:
execute/search only if the file is a directory or already has execute permission for some ...
4
votes
2answers
768 views
recursively change file permission but not directories?
I was doing a mass recursive change of permissions of some files that I had migrated to a unix system. I changed them to ug+rw, but then I found that I could not traverse subdirectories. I looked at ...
4
votes
3answers
378 views
Unix users, groups, and permissions
I don't understand unix users, groups, permissions, etc. For example, things managed by the chmod, chgrp, usermod, groupadd, etc. commands. How do all these things work?
3
votes
3answers
1k views
How to get permission number by string : -rw-r--r--
I need to set the same chmod, how to get number for -rw-r--r-- ?
3
votes
2answers
346 views
Why does “chmod 1777” and “chmod 3777” both set the sticky bit?
To set the sticky bit on a directory, why do the commands chmod 1777 and chmod 3777 both work?
3
votes
4answers
220 views
Run a given command on every subpath of a long path
Say I have a long path such as:
/a/b/c/d/e/f
I would like to run a command only on each of the subpaths of the path:
e.g. If my command is cmd, I am looking for a one-liner that can do (perhaps ...
3
votes
4answers
83 views
chmod recursive permission on thousands of files
This is a more general question about 'chmoding' recursively.
I have this script which at some point needs to change the permissions recursively in a folder which has a few hundred thousand files.
...
3
votes
1answer
104 views
Make group permissions same as user permissions
I want to set the group permissions for all files and subdirectories within a certain parent directory to whatever the user permission setting for that specific file or directory is.
For example, ...
3
votes
2answers
409 views
How to make a folder request root password to view execute?
I am running Ubuntu 10.04 LTS. I want to use my laptop to play music in a party. MY screensaver does not need a password to deactivate. I would like to allow people to use my computer to play the ...
3
votes
1answer
143 views
How to create a folder which will change its contents’ ownership to what the folder has?
In a GNU/Linux OS there is no way to change ownership of a file until you are root. But what if I want to hide my system’s username e.g. before sending a file to someone, because some things like tar ...
3
votes
1answer
130 views
Clear setuid permission using numeric mode
On an Ubuntu Linux I have a directory with the setuid bit set (drwsr-xr-x) which I want to unset.
Neither chmod 755 nor chmod 0755 nor chmod 00755 (I though maybe the first 0 is interpreted as just ...
3
votes
1answer
440 views
Giving SSH users read-only access to a directory
I'm running Fedora 17 and I want to give several users access to files on my secondary hard drives on /run/media/haukur/. This is what I initially did:
chmod -R 755 /run/media/
But every time I ...
3
votes
1answer
557 views
copying device nodes
I'm trying to transfer a working Linux installation to a new larger disk, so I've attached the new disk on a USB port, partitioned it and created filesystems.
While copying all the files over I hit a ...
3
votes
1answer
298 views
Vanishing permission on device file (RHEL 6.1)
I want to set world read/write permissions on a raw block device file (yeah, I know). I can set the permission to 666, but it goes back to 660 immediately after I touch it or write to it. Why?
...
3
votes
2answers
57 views
How can a user restrict their own group rights without being root?
How can I change my user rights from rwx to r-x at the group level? I'm trying to ensure that I cannot touch any data belonging to other users when I am developing and debugging my scripts. Once I've ...
3
votes
1answer
97 views
Change who is able to chmod
Is there a way to change who can chmod (change the permissions of) a particular file?
It is only the owner of the file (without sudo-ing it), if my experimentation has been correct?
But what I want ...
2
votes
4answers
787 views
How to make executable of all files excluding a few file types?
I have a folder containing many C source file and the same number of its compiled output files.
I set executable bit to all this files but for some reason it was lost, making them not executable. (I ...
2
votes
2answers
147 views
execute bit on directories, but not files [duplicate]
Possible Duplicate:
How to apply recursively chmod directories without affecting files?
What is the command to apply execute permission for directories (for traversal), but leave the ...
2
votes
1answer
144 views
chmod -R 644 ~/Documents
I recently noticed that all of the files in my ~/Documents were somehow incorrectly given executable status. This proved annoying as trying to opening any file gave me a message box saying it was ...
2
votes
3answers
719 views
Change Folder Permissions
I started off with changing to the folder I want to change permissions for, and that is the opt folder.
$ cd /opt/
test@testVM:/opt$
So I tried changing the permissions for this folder now using:
...
2
votes
1answer
2k views
chmod: What does the `+a` parameter mean?
I was following a tutorial and it told me to run
sudo chmod +a "SOME_PARAMS" some/dir
I was surprised to see that fail telling me
chmod: invalid mode: `+a'
So I wonder: What does the +a mode ...
2
votes
1answer
1k views
Why can I not chmod a file?
[nathanb@ka /x/sim/nathanb/nbsim1] ls -al ,nvram
-rw-r--r-- 1 root root 2097152 Jul 5 2011 ,nvram
[nathanb@ka /x/sim/nathanb/nbsim1] sudo chmod a+w ,nvram
chmod: changing permissions of ...
2
votes
1answer
454 views
No effect of umask and chmod on mounted drives
The windows drives are mounted at boot-time using pysdm. The setting were
nls=iso8859-1,users,umask=002,sync,user,dirsync,uid=mtk
When I try to change the permission of files using chmod, I don't ...
2
votes
2answers
124 views
Unable to change permissions of file system root
When I write ls -la the output is :
tusharmakkar08-Satellite-C660 tusharmakkar08 # ls -la
total 88
drwxr-x---+ 10 root root 4096 Apr 18 19:43 .
drwxr-xr-x 4 root root 4096 Mar 18 17:35 ..
...
2
votes
3answers
131 views
User with read access to /home
Pardon my ignorance but I can't seem to come up with a solution to this one.
I'd like to create a user that has read access to every user's home catalog located in /home.
Do I need acl's for this or ...
2
votes
2answers
2k views
Find web server group? Permissions problem
I'm trying to make Wordpress work. I currently have this error message:
Could not create directory.
/var/www/html/wp-content/upgrade/theme_name
when trying to upload a theme. This is the ...
1
vote
7answers
227 views
Convert ls -l output format to chmod format
Say I have the following output from ls -l:
drwxr-xr-x 2 root root 4096 Apr 7 17:21 foo
How can I automatically convert this to the format used by chmod?
For example:
$ echo drwxr-xr-x | ...
1
vote
1answer
73 views
chmod and chown not working in sudo called script
Based on this Serverfault question, my git user has permission in sudoers to run a wrapper script to move files into my webroot with git.
Everything is working fine except for the chmod and chown ...
1
vote
2answers
80 views
chmod wont work - no error message
Everytime I try to change the permissions of a file with chmod on my Ubuntu with a command like
chmod 744 /media/DATEN/Dokumente/Coding/Python/DirFileFuncts.py it doesnt work. I tried octal and =rwx ...
