How to change permissions (chmod) of files, folders or sub folders

David Beroff

Well-known member
Registered
Joined
Jun 14, 2016
Messages
1,501
Points
63
Hello everyone,
Are there any ways via SSH that I can change the permissions (755) of files, folders and sub folders without doing one by one.
I have have shell(SSH) access and I want to change the permissions recursively
 

Luxin Host

Well-known member
Registered
Joined
Jun 26, 2016
Messages
543
Points
43
Use the code below:
Code:
chmod XXX file
Incase you want to change the ownership of a file use the code below: (useful for multi user use)
Code:
chown username:username file
 

MooseLucifer

Well-known member
Registered
Joined
May 20, 2016
Messages
149
Points
28
MooseLucifer
Are you sure this command is correct?

I suppose replacing : by . is correct

For examples:

Using a path to folder you want to change the ownership

Code:
#chown -R username.username /path/to/folder/*
or at parent directory

Code:
chown username.username public_html -R
For a specific file

Code:
chown -R username.username /path/to/folder/filename
 

Kaz Wolfe

Well-known member
Registered
Joined
Jul 7, 2016
Messages
609
Points
28
Hello everyone,
Are there any ways via SSH that I can change the permissions (755) of files, folders and sub folders without doing one by one.
I have have shell(SSH) access and I want to change the permissions recursively
If you have SSH, to change the permission to 755 recursively, just typing below command

Code:
chmod -R 755 foldername
or

Code:
chmod 755 /home/user/public_html/subfolder -R
This will automatically change the permission to 755 of the files, folders and subfolders inside the foldename

If you want to change just the directory permissions then use the following command:

Code:
find ./* -type d | xargs chmod 755
And if you want to change the permission 755 to only directories in subfolder

Code:
cd /home/user/public_html/subfolder 
find . -type d -exec chmod 755 {} \;
And if you want to change the permission 755 to only files in subfolder

Code:
cd /home/user/public_html/subfolder 
find . -type f -exec chmod 755 {} \;
 
Latest Threads
Replies
0
Views
32
Replies
1
Views
39
Replies
0
Views
234
Replies
1
Views
49
Recommended Threads

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top