Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
m new to linux . and was practicing on my system . ok so i wish to change the permissions of all the directories inside /etc directory to 777 ,just with 2-3 lines of commands , how should i proceed ?
Before I answer your question, you really shouldn't chmod your whole /etc tree, due to security reasons. That being said though, you can use chmod for this simple task, as such:
Code:
chmod -R 777 /etc
The -R flag means to use chmod recursively, which is what you would want to do to change permissions for all files and subdirectories within /etc. Hope this helps!
well thanx fr reply ,but what if i want to change permission of subdirectories only , not the files in /etc . AS there are numerous subdirectories in /etc , so thats obvious 'm not going to change permission one by one . need some alternate way out !
This will find all directories, with a minimum of one directory deep, in /etc for you. Now from here, you can use either the -exec argument with the find command, or you can pipe that to xargs, as such:
Code:
find /etc/ -mindepth 1 -type d | xargs chmod 777 # this is the xargs example
find /etc/ -maxdepth 1 -type d -exec chmod 777 {} \; # this is using only the find command without piping to xargs, using -exec
Hope this helps!
Josh
Edit - You can also read up the man pages for the find and xargs commands for more information. Type "man find", etc.
when i switched from Windows to CentOS, i copied tons of files from ntfs usb drive to ext4 home folder. In CentOS default user's permission for directory is 775 and 664 for files.
when i switched from Windows to CentOS, i copied tons of files from ntfs usb drive to ext4 home folder. In CentOS default user's permission for directory is 775 and 664 for files.
1) What is the point of -iname "*"? Why bother including it since it's not filtering anything?
2) You're already finding all directories, so the -R flag in the first chmod is redundant and very inefficient since it's going to be chmodding ALL files in ALL directories multiple times
3) The -R in the second chmod is doing nothing since you're only matching files
4) The -R in the chown is redundant and very inefficient since you're already running the command on all files and directories
Last edited by suicidaleggroll; 03-28-2013 at 09:48 AM.
1) What is the point of -iname "*"? Why bother including it since it's not filtering anything?
2) You're already finding all directories, so the -R flag in the first chmod is redundant and very inefficient since it's going to be chmodding ALL files in ALL directories multiple times
3) The -R in the second chmod is doing nothing since you're only matching files
4) The -R in the chown is redundant and very inefficient since you're already running the command on all files and directories
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.