2

When a user creates a folder over SFTP it gets permissions of

drwxr-xr-x 

I need it to have

drwxrw-r-- 

I know i can change the permissions with chmod but it would save me lots of time and effort if the folder could be created with the correct permissions from the start. Is there a way to change the default permissions for when a specific user creates a folder?

1 Answer 1

3

Directories are typically created with all permission bits set (see for example mkdir, when the mode isn’t specified explicitly), except those masked by the current umask, so you can set that for the user you’re interested in;

umask 013 

will produce the result you’re after under such circumstances.

For your specific sftp requirements, see Proper way to set the umask for SFTP transactions?

Other approaches can be used if your file system supports ACLs and you don’t need to limit this to a single user; see How to set default file permissions for all folders/files in a directory? for details.

5
  • … except for install -d which defaults to 00755. (-: Commented Jan 17, 2020 at 11:32
  • Thanks for this, i want this change only to apply to a single user - not sure if this makes a different but the user can only access the server over sftp - when they created a folder is where i saw this behaviour. Commented Jan 17, 2020 at 11:40
  • Yes, this is specific to a user, the umask is set per process. I’ll have to check whether this is usable over sftp; please add that requirement to the question. Commented Jan 17, 2020 at 12:16
  • Im sure this is for a lack of knowledge on my part but i am not clear how to set the umask on my specific user Commented Jan 17, 2020 at 13:49
  • See the link I added in my answer. Commented Jan 17, 2020 at 13:51

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.