change permission of directory and all its sub-directories/files recursively


up vote
1
down vote
favorite
I have search around but can't find the correct answer.
How do I change the permission of a directory and all its sub-directories/files then also when a user creates a file or directory this must also follow the same permissions set at the beginning.
Basically this is what i want to do:
Keep in mind I am running a Ubuntu Server 16.04.3 with 2 virtual hosts (so 2 separate IP's used)
- create a new virtual host (i have completed this)
- create a new directory
/var/www/example
(i have completed this) - created new group and user with the same name(as i wanted to mimic the same as www-data user and group.)
change ownership of directory:
-- used command:sudo chown -R user:group /var/www/example
(this change the owner to my desired owner and group owner)set permissions of this directory to 775
-- used command:sudo chmod -R 775 /var/www/example
(this changed the permissions)
after all of these done i am still able to use a user to create a file which is good as this user is in the group i created but the thing is that the permissions are all wrong and the file owner is also wrong. (the user i used is also part of another group that is used on the other virtual host).
Please guide me to a solution. thanks
permissions chmod chown administration
add a comment |Â
up vote
1
down vote
favorite
I have search around but can't find the correct answer.
How do I change the permission of a directory and all its sub-directories/files then also when a user creates a file or directory this must also follow the same permissions set at the beginning.
Basically this is what i want to do:
Keep in mind I am running a Ubuntu Server 16.04.3 with 2 virtual hosts (so 2 separate IP's used)
- create a new virtual host (i have completed this)
- create a new directory
/var/www/example
(i have completed this) - created new group and user with the same name(as i wanted to mimic the same as www-data user and group.)
change ownership of directory:
-- used command:sudo chown -R user:group /var/www/example
(this change the owner to my desired owner and group owner)set permissions of this directory to 775
-- used command:sudo chmod -R 775 /var/www/example
(this changed the permissions)
after all of these done i am still able to use a user to create a file which is good as this user is in the group i created but the thing is that the permissions are all wrong and the file owner is also wrong. (the user i used is also part of another group that is used on the other virtual host).
Please guide me to a solution. thanks
permissions chmod chown administration
Check this: superuser.com/questions/381416/â¦
â Sebastian Stark
May 4 at 11:21
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have search around but can't find the correct answer.
How do I change the permission of a directory and all its sub-directories/files then also when a user creates a file or directory this must also follow the same permissions set at the beginning.
Basically this is what i want to do:
Keep in mind I am running a Ubuntu Server 16.04.3 with 2 virtual hosts (so 2 separate IP's used)
- create a new virtual host (i have completed this)
- create a new directory
/var/www/example
(i have completed this) - created new group and user with the same name(as i wanted to mimic the same as www-data user and group.)
change ownership of directory:
-- used command:sudo chown -R user:group /var/www/example
(this change the owner to my desired owner and group owner)set permissions of this directory to 775
-- used command:sudo chmod -R 775 /var/www/example
(this changed the permissions)
after all of these done i am still able to use a user to create a file which is good as this user is in the group i created but the thing is that the permissions are all wrong and the file owner is also wrong. (the user i used is also part of another group that is used on the other virtual host).
Please guide me to a solution. thanks
permissions chmod chown administration
I have search around but can't find the correct answer.
How do I change the permission of a directory and all its sub-directories/files then also when a user creates a file or directory this must also follow the same permissions set at the beginning.
Basically this is what i want to do:
Keep in mind I am running a Ubuntu Server 16.04.3 with 2 virtual hosts (so 2 separate IP's used)
- create a new virtual host (i have completed this)
- create a new directory
/var/www/example
(i have completed this) - created new group and user with the same name(as i wanted to mimic the same as www-data user and group.)
change ownership of directory:
-- used command:sudo chown -R user:group /var/www/example
(this change the owner to my desired owner and group owner)set permissions of this directory to 775
-- used command:sudo chmod -R 775 /var/www/example
(this changed the permissions)
after all of these done i am still able to use a user to create a file which is good as this user is in the group i created but the thing is that the permissions are all wrong and the file owner is also wrong. (the user i used is also part of another group that is used on the other virtual host).
Please guide me to a solution. thanks
permissions chmod chown administration
edited May 4 at 11:11


Byte Commander
59k26158265
59k26158265
asked May 4 at 11:07
Deez Nutz
206
206
Check this: superuser.com/questions/381416/â¦
â Sebastian Stark
May 4 at 11:21
add a comment |Â
Check this: superuser.com/questions/381416/â¦
â Sebastian Stark
May 4 at 11:21
Check this: superuser.com/questions/381416/â¦
â Sebastian Stark
May 4 at 11:21
Check this: superuser.com/questions/381416/â¦
â Sebastian Stark
May 4 at 11:21
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f1031931%2fchange-permission-of-directory-and-all-its-sub-directories-files-recursively%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
Check this: superuser.com/questions/381416/â¦
â Sebastian Stark
May 4 at 11:21