umask issues

PashPash Member Posts: 1,600 ■■■■■□□□□□
Hi peeps,

So. I have setup vsftpd for a user with no shell login. I can upload files fine. This user is the owner of the directory. Below is the umask part of my /etc/bashrc.


if [ $UID -gt 99 ] && [ "`id -gn`" = "`id -un`" ]; then
umask 002
else
umask 022

When I load a file up though my permissions as follows:-

-rw

Anything I am forgetting from vsftpd config?

I probably am forgetting something. It's been a while since ive chrooted an ftp account and set umask stuff. I should mention this folder is also the document root for a virtual host in apache!

Really need help!!!
DevOps Engineer and Security Champion. https://blog.pash.by - I am trying to find my writing style, so please bear with me.

Comments

  • /pub/beer//pub/beer/ Member Posts: 67 ■■■□□□□□□□
    Pash wrote: »
    Anything I am forgetting from vsftpd config?

    I probably am forgetting something. It's been a while since ive chrooted an ftp account and set umask stuff. I should mention this folder is also the document root for a virtual host in apache!

    Really need help!!!

    What is the end result that you are going for?

    You can use certain options in the /etc/vsftpd/vsftpd.conf to come up with your goal.


    chown_uploads=YES
    chown_username=webuser
    anonymous_enable=NO
    local_umask=022 (or 002 if you want group writable)

    Then maybe set the GUID bit for the folder so everything in the folder is always owned by the same group.

    etc ...

    Unless I'm reading this incorrectly - but setting the umask for the shell wouldn't affect a file being written by FTP.
    Certification Goal:
    - ¯\_(ツ)_/¯
  • PashPash Member Posts: 1,600 ■■■■■□□□□□
    You arent missing it. Your explanation was great. It was my mistake because I didnt understand umask enough before today :)

    Thats sorted now thanks :)
    DevOps Engineer and Security Champion. https://blog.pash.by - I am trying to find my writing style, so please bear with me.
Sign In or Register to comment.