?
Solved

chmod command

Posted on 2000-04-11
2
Medium Priority
?
229 Views
Last Modified: 2010-04-20
Setting permissions through directories..

i.e.

How can I change the permissions for
subdir1 & 2 and the 4 files at once?
(all to 777)

maindir/subdir1/file1
maindir/subdir1/file2
maindir/subdir2/file1
maindir/subdir2/file2
0
Comment
Question by:Karina051699
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
dserna earned 300 total points
ID: 2706005
You could do:
: dserna@ns:~/maindir: cd /maindir
: dserna@ns:~/maindir: pwd
/maindir
: dserna@ns:~/maindir: chmod -R 777 *
: dserna@ns:~/maindir: ls -al
total 12
drwxr-xr-x   4 dserna   sysadmin     512 Apr 11 17:46 .
drwxr-xr-x  27 dserna   sysadmin    3072 Apr 11 17:46 ..
drwxrwxrwx   2 dserna   sysadmin     512 Apr 11 17:46 subdir1
drwxrwxrwx   2 dserna   sysadmin     512 Apr 11 17:46 subdir2
: dserna@ns:~/maindir: ls -al subdir1
total 4
drwxrwxrwx   2 dserna   sysadmin     512 Apr 11 17:46 .
drwxr-xr-x   4 dserna   sysadmin     512 Apr 11 17:46 ..
-rwxrwxrwx   1 dserna   sysadmin       0 Apr 11 17:46 file1
-rwxrwxrwx   1 dserna   sysadmin       0 Apr 11 17:46 file2
: dserna@ns:~/maindir: ls -al subdir2
total 4
drwxrwxrwx   2 dserna   sysadmin     512 Apr 11 17:46 .
drwxr-xr-x   4 dserna   sysadmin     512 Apr 11 17:46 ..
-rwxrwxrwx   1 dserna   sysadmin       0 Apr 11 17:46 file1
-rwxrwxrwx   1 dserna   sysadmin       0 Apr 11 17:46 file2
: dserna@ns:~/maindir:


Hope that helps.

-Daniel-
0
 
LVL 3

Expert Comment

by:DVB
ID: 2709645
Uhh, how about man (or info)chmod first please? chmod -R or chmod --recursive.
From the chmod man page:
-R, --recursive              change files and directories recursively    
dserna has got the answer anyway, so (s)he deserves the points. I posted just to make the solution stand out.
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month11 days, 3 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question