how set read and write permissions for a directory
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
0
down vote
favorite
I just copied a 2.8 Gb folder to my usr/home directory using Nautilus. It contains many folders and files but I have permission to read none of them. How can I globally set read & write & execute permissions for myself.
I have one user account & the root account on my computer. However I don't want to do everything as root.
permissions
add a comment |Â
up vote
0
down vote
favorite
I just copied a 2.8 Gb folder to my usr/home directory using Nautilus. It contains many folders and files but I have permission to read none of them. How can I globally set read & write & execute permissions for myself.
I have one user account & the root account on my computer. However I don't want to do everything as root.
permissions
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I just copied a 2.8 Gb folder to my usr/home directory using Nautilus. It contains many folders and files but I have permission to read none of them. How can I globally set read & write & execute permissions for myself.
I have one user account & the root account on my computer. However I don't want to do everything as root.
permissions
I just copied a 2.8 Gb folder to my usr/home directory using Nautilus. It contains many folders and files but I have permission to read none of them. How can I globally set read & write & execute permissions for myself.
I have one user account & the root account on my computer. However I don't want to do everything as root.
permissions
permissions
asked Mar 9 at 22:37
![](https://i.stack.imgur.com/YrmmV.jpg?s=32&g=1)
![](https://i.stack.imgur.com/YrmmV.jpg?s=32&g=1)
Nicholas Bourbaki
1
1
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
0
down vote
sudo chown -R username <folderpath>
sudo chmod -R 644 <folderpath>
Explanation:
chown makes the username the owner of the folder (-R does it recursively)
chmod changes all the permissions to be read and write for the users. It's an optional step. You can skip it if you know the permissions to be correct and/or have executable files inside the folder with +x set.
1
chmod -R 644
removes execute permission from directories - which will make everything below<folderpath>
inaccessible
â steeldriver
Mar 9 at 23:17
add a comment |Â
up vote
0
down vote
First change the ownership:
sudo chown -R username: <directory>
(the :
after the username means in fact the user default group, so it resets the group too at the same time)
Now you do not need sudo anymore you can operate under your normal user account.
First get yourself read and write access to all content:
chmod -R u=rw,go=r <directory>
Which means Read and Write access for User (the user owning the files, so that is you), but only Read for Group and Other. The =
means to set the right, whatever it is now, you can also use +
and -
to respectively add or remove the given permission.
You can prefer:
chmod -R ug=rw,o=r <directory>
or even:
chmod -R ug=rw,o= <directory>
And the result should be clear from the explanation above (I do not know why people absolutely continue to use octal encoding to do the same thing, it has no superior value, but anyway if needed, Read is 4, Write is 2 and eXecute is 1, and you have to add the values. So my last example would be 660)
There is only one remaining step. You need to put the eXecute right on each directory and subdirectory otherwise cd
will not work.
For that you can do:
find directory -type d | xargs chmod u+x
The find
command like it says will find, starting at directory
every object that is of type d, d meaning directory here, and the xargs
command will apply the following (chmod u+x
) on all of them, and based on the previous explanations, the u+x
part should be straightforward.
Also, next time, if you start the copy directly under your username, the permissions should be ok from the beginning. If not it means you may have strange permissions on the top directory where you do the copy.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
sudo chown -R username <folderpath>
sudo chmod -R 644 <folderpath>
Explanation:
chown makes the username the owner of the folder (-R does it recursively)
chmod changes all the permissions to be read and write for the users. It's an optional step. You can skip it if you know the permissions to be correct and/or have executable files inside the folder with +x set.
1
chmod -R 644
removes execute permission from directories - which will make everything below<folderpath>
inaccessible
â steeldriver
Mar 9 at 23:17
add a comment |Â
up vote
0
down vote
sudo chown -R username <folderpath>
sudo chmod -R 644 <folderpath>
Explanation:
chown makes the username the owner of the folder (-R does it recursively)
chmod changes all the permissions to be read and write for the users. It's an optional step. You can skip it if you know the permissions to be correct and/or have executable files inside the folder with +x set.
1
chmod -R 644
removes execute permission from directories - which will make everything below<folderpath>
inaccessible
â steeldriver
Mar 9 at 23:17
add a comment |Â
up vote
0
down vote
up vote
0
down vote
sudo chown -R username <folderpath>
sudo chmod -R 644 <folderpath>
Explanation:
chown makes the username the owner of the folder (-R does it recursively)
chmod changes all the permissions to be read and write for the users. It's an optional step. You can skip it if you know the permissions to be correct and/or have executable files inside the folder with +x set.
sudo chown -R username <folderpath>
sudo chmod -R 644 <folderpath>
Explanation:
chown makes the username the owner of the folder (-R does it recursively)
chmod changes all the permissions to be read and write for the users. It's an optional step. You can skip it if you know the permissions to be correct and/or have executable files inside the folder with +x set.
answered Mar 9 at 22:38
![](https://lh4.googleusercontent.com/-Fp0Wp5c_Q-U/AAAAAAAAAAI/AAAAAAAABxo/7CH-TCX1kqU/photo.jpg?sz=32)
![](https://lh4.googleusercontent.com/-Fp0Wp5c_Q-U/AAAAAAAAAAI/AAAAAAAABxo/7CH-TCX1kqU/photo.jpg?sz=32)
Adnan Y
1012
1012
1
chmod -R 644
removes execute permission from directories - which will make everything below<folderpath>
inaccessible
â steeldriver
Mar 9 at 23:17
add a comment |Â
1
chmod -R 644
removes execute permission from directories - which will make everything below<folderpath>
inaccessible
â steeldriver
Mar 9 at 23:17
1
1
chmod -R 644
removes execute permission from directories - which will make everything below <folderpath>
inaccessibleâ steeldriver
Mar 9 at 23:17
chmod -R 644
removes execute permission from directories - which will make everything below <folderpath>
inaccessibleâ steeldriver
Mar 9 at 23:17
add a comment |Â
up vote
0
down vote
First change the ownership:
sudo chown -R username: <directory>
(the :
after the username means in fact the user default group, so it resets the group too at the same time)
Now you do not need sudo anymore you can operate under your normal user account.
First get yourself read and write access to all content:
chmod -R u=rw,go=r <directory>
Which means Read and Write access for User (the user owning the files, so that is you), but only Read for Group and Other. The =
means to set the right, whatever it is now, you can also use +
and -
to respectively add or remove the given permission.
You can prefer:
chmod -R ug=rw,o=r <directory>
or even:
chmod -R ug=rw,o= <directory>
And the result should be clear from the explanation above (I do not know why people absolutely continue to use octal encoding to do the same thing, it has no superior value, but anyway if needed, Read is 4, Write is 2 and eXecute is 1, and you have to add the values. So my last example would be 660)
There is only one remaining step. You need to put the eXecute right on each directory and subdirectory otherwise cd
will not work.
For that you can do:
find directory -type d | xargs chmod u+x
The find
command like it says will find, starting at directory
every object that is of type d, d meaning directory here, and the xargs
command will apply the following (chmod u+x
) on all of them, and based on the previous explanations, the u+x
part should be straightforward.
Also, next time, if you start the copy directly under your username, the permissions should be ok from the beginning. If not it means you may have strange permissions on the top directory where you do the copy.
add a comment |Â
up vote
0
down vote
First change the ownership:
sudo chown -R username: <directory>
(the :
after the username means in fact the user default group, so it resets the group too at the same time)
Now you do not need sudo anymore you can operate under your normal user account.
First get yourself read and write access to all content:
chmod -R u=rw,go=r <directory>
Which means Read and Write access for User (the user owning the files, so that is you), but only Read for Group and Other. The =
means to set the right, whatever it is now, you can also use +
and -
to respectively add or remove the given permission.
You can prefer:
chmod -R ug=rw,o=r <directory>
or even:
chmod -R ug=rw,o= <directory>
And the result should be clear from the explanation above (I do not know why people absolutely continue to use octal encoding to do the same thing, it has no superior value, but anyway if needed, Read is 4, Write is 2 and eXecute is 1, and you have to add the values. So my last example would be 660)
There is only one remaining step. You need to put the eXecute right on each directory and subdirectory otherwise cd
will not work.
For that you can do:
find directory -type d | xargs chmod u+x
The find
command like it says will find, starting at directory
every object that is of type d, d meaning directory here, and the xargs
command will apply the following (chmod u+x
) on all of them, and based on the previous explanations, the u+x
part should be straightforward.
Also, next time, if you start the copy directly under your username, the permissions should be ok from the beginning. If not it means you may have strange permissions on the top directory where you do the copy.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
First change the ownership:
sudo chown -R username: <directory>
(the :
after the username means in fact the user default group, so it resets the group too at the same time)
Now you do not need sudo anymore you can operate under your normal user account.
First get yourself read and write access to all content:
chmod -R u=rw,go=r <directory>
Which means Read and Write access for User (the user owning the files, so that is you), but only Read for Group and Other. The =
means to set the right, whatever it is now, you can also use +
and -
to respectively add or remove the given permission.
You can prefer:
chmod -R ug=rw,o=r <directory>
or even:
chmod -R ug=rw,o= <directory>
And the result should be clear from the explanation above (I do not know why people absolutely continue to use octal encoding to do the same thing, it has no superior value, but anyway if needed, Read is 4, Write is 2 and eXecute is 1, and you have to add the values. So my last example would be 660)
There is only one remaining step. You need to put the eXecute right on each directory and subdirectory otherwise cd
will not work.
For that you can do:
find directory -type d | xargs chmod u+x
The find
command like it says will find, starting at directory
every object that is of type d, d meaning directory here, and the xargs
command will apply the following (chmod u+x
) on all of them, and based on the previous explanations, the u+x
part should be straightforward.
Also, next time, if you start the copy directly under your username, the permissions should be ok from the beginning. If not it means you may have strange permissions on the top directory where you do the copy.
First change the ownership:
sudo chown -R username: <directory>
(the :
after the username means in fact the user default group, so it resets the group too at the same time)
Now you do not need sudo anymore you can operate under your normal user account.
First get yourself read and write access to all content:
chmod -R u=rw,go=r <directory>
Which means Read and Write access for User (the user owning the files, so that is you), but only Read for Group and Other. The =
means to set the right, whatever it is now, you can also use +
and -
to respectively add or remove the given permission.
You can prefer:
chmod -R ug=rw,o=r <directory>
or even:
chmod -R ug=rw,o= <directory>
And the result should be clear from the explanation above (I do not know why people absolutely continue to use octal encoding to do the same thing, it has no superior value, but anyway if needed, Read is 4, Write is 2 and eXecute is 1, and you have to add the values. So my last example would be 660)
There is only one remaining step. You need to put the eXecute right on each directory and subdirectory otherwise cd
will not work.
For that you can do:
find directory -type d | xargs chmod u+x
The find
command like it says will find, starting at directory
every object that is of type d, d meaning directory here, and the xargs
command will apply the following (chmod u+x
) on all of them, and based on the previous explanations, the u+x
part should be straightforward.
Also, next time, if you start the copy directly under your username, the permissions should be ok from the beginning. If not it means you may have strange permissions on the top directory where you do the copy.
answered Mar 9 at 23:19
![](https://i.stack.imgur.com/mPL7x.png?s=32&g=1)
![](https://i.stack.imgur.com/mPL7x.png?s=32&g=1)
Patrick Mevzek
2681212
2681212
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1013528%2fhow-set-read-and-write-permissions-for-a-directory%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password