-2

Using SFTP I want to copy the log directory from var.

By default my user have permission denied without sudo. Root is blocked for login, besides I don't want to use it in sftp.

I want to give my user permission to log directory without needing sudo.

so being in var I tried:

sudo chmod -R u+r log

no error back, but still no permission on sftp

I'm using Ubuntu Server 18.04.

1

According to chmod manpage the following command sets the readable permission to owner user :

sudo chmod -R u+r log

To set readable permission to all users use instead:

sudo chmod -R o+r log

However, I would recommand using ACLs to avoid anyone can read (which can be a security concern). Assuming your user login is mylogin, you could use:

setfacl -R -m u:mylogin:rX log
  • -R : recursive action
  • -m u:mylogin:rX : grants access to user mylogin

To remove this ACL, use:

setfacl -R -x u:mylogin:r log
  • the first command removed my listing rights, the second when I try to remove the acl, -x invalid argument – user3541631 Nov 28 '18 at 12:01
  • I updated my answer with rX which should preserve listing permission – lauhub Nov 28 '18 at 12:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.