LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How can i make user always create files + folders with 775 permission ? Please help (https://www.linuxquestions.org/questions/linux-software-2/how-can-i-make-user-always-create-files-folders-with-775-permission-please-help-4175594846/)

ParanoiaUser 12-05-2016 01:40 PM

How can i make user always create files + folders with 775 permission ? Please help
 
Hello,

I am trying to achieve the following on Debian, i need to have testuser create all his files + folders with 775 permission, everything this user creates i would like for it to have that permission.

I would be VERY appreciative if someone could tell me how to do this.

---
What will also work would be some way i could set a folder to always have that permission no matter what is written in it and by who.

lazydog 12-05-2016 01:56 PM

Have a look at umask.

ParanoiaUser 12-05-2016 02:27 PM

Quote:

Originally Posted by lazydog (Post 5638313)
Have a look at umask.


Reading about it but still no luck so far.

c0wb0y 12-05-2016 03:25 PM

Read some more?

szboardstretcher 12-05-2016 03:28 PM

in the users .bash_profile or .bashrc file add the line:

Code:

umask 0002
You can just type 'umask' on the command line to see the current umask.

ParanoiaUser 12-05-2016 04:28 PM

Thank you for your replies.

I have

umask 0002

If i create a new file via SFTP, it gets permission 0644 rw-r--r-- , i also need write for the group so it didnt do the trick :(.

John VV 12-05-2016 04:37 PM

Quote:

If i create a new file via SFTP,
now that ads a twist
this is a REMOTE login

that should have been posted in the very first post and NOT just finding this out in post #6

what software are you using and what is the host?

and you REALLY DO NOT !!!!! want remote users using 775

Habitual 12-05-2016 05:09 PM

Quote:

Originally Posted by ParanoiaUser (Post 5638376)
Thank you for your replies.

I have

umask 0002

If i create a new file via SFTP, it gets permission 0644 rw-r--r-- , i also need write for the group so it didnt do the trick :(.

This activity have any thing to do with apache?

ParanoiaUser 12-06-2016 04:41 AM

Quote:

Originally Posted by Habitual (Post 5638392)
This activity have any thing to do with apache?

Nope.

--

So, i have 2 users, we'll call them user1 and user2.

User1 will have access to SFTP + SSH, user2 will have access only to FTP.

If user1 creates a file, user2 will not have write permission for that file when connected to FTP.

I need to give user2 write access to the file, how can i do this?

BW-userx 12-06-2016 07:48 AM

Quote:

Originally Posted by ParanoiaUser (Post 5638302)
Hello,

I am trying to achieve the following on Debian, i need to have testuser create all his files + folders with 775 permission, everything this user creates i would like for it to have that permission.

I would be VERY appreciative if someone could tell me how to do this.

---
What will also work would be some way i could set a folder to always have that permission no matter what is written in it and by who.

What is Umask and How To Setup Default umask Under Linux?

ParanoiaUser 12-06-2016 10:48 AM

Quote:

Originally Posted by BW-userx (Post 5638606)



Quote:

Originally Posted by ParanoiaUser (Post 5638376)
Thank you for your replies.

I have

umask 0002

If i create a new file via SFTP, it gets permission 0644 rw-r--r-- , i also need write for the group so it didnt do the trick :(.

I've already tried to set that up :(.

BW-userx 12-06-2016 11:03 AM

Quote:

Originally Posted by ParanoiaUser (Post 5638686)
I've already tried to set that up :(.

you might have thought of this or tried it already, but have you tried using groups with them permissions/limits attached to it, then who ever is assigned to that group can, and them not attached to that group cannot?

Guttorm 12-06-2016 11:21 AM

Hello

Maybe this has to do with SFTP? If the idea is that they can transfer files but not run scripts, I think you need to put the umask in the sshd config.

http://riaschissl.bestsolution.at/20...mask-for-sftp/

ParanoiaUser 12-06-2016 11:46 AM

Quote:

Originally Posted by BW-userx (Post 5638692)
you might have thought of this or tried it already, but have you tried using groups with them permissions/limits attached to it, then who ever is assigned to that group can, and them not attached to that group cannot?

I have added them like this in etc/group

user1:x:1000:user2
user2:x:1001:user1

Should i change something ? hmm.

Maybe they are not added correctly ?

BW-userx 12-06-2016 11:56 AM

Quote:

Originally Posted by Guttorm (Post 5638699)
Hello

Maybe this has to do with SFTP? If the idea is that they can transfer files but not run scripts, I think you need to put the umask in the sshd config.

http://riaschissl.bestsolution.at/20...mask-for-sftp/

can execute just not write to is the only thing that the OP seems to be worried about.


Quote:

0775
user group other
setuid is unset can read can read can read
setgid is unset can write can write cannot write
Sticky bit is unset can execute can execute can execute
and that only pertains to other that the write permissions have been removed from.


All times are GMT -5. The time now is 02:05 AM.