How to properly use group access and chgrp?
I attempting to deploy files to a remote server using SSH.
My username joe
is a member of the group www
.
I am SSH'ing in as joe, and creating a new folder (let's call it test
). The parent folder's owners are root:www
. When I issue the mkdir /parent/test
command over ssh, the owners for the new directory are joe:joe
. I'd like the group to be set to www
.
If I attempt to issue the command chgrp www /parent/test
, I get a permission denied error.
www:www
that would be nice. I just want to be able to create files on the remote server, while logging in as my username, and then change the group of the files to www
.
Thanks in advance.
Try using newgrp
before using mkdir
to "log in" to a new group
mymachine$ ssh joe@remotemachine
remotemachine$ newgrp www
remotemachine$ mkdir /parent/test
精彩评论