U
U
uhryab2011-10-31 15:21:15
linux
uhryab, 2011-10-31 15:21:15

On sftp linux server files are created with ------- permissions. What could be wrong?

SFTP server on SUSE Linux Enterprise Server 11 (x86_64) PATCHLEVEL = 1.
SFTP settings /etc/ssh/sshd_config

Subsystem sftp internal-sftp -l VERBOSE -f LOCAL6

Match Group sftponly
ChrootDirectory %h
AllowTcpForwarding no
X11Forwarding no


Settings in /etc/syslog -ng/syslog-ng.conf

unix-dgram("/home/user/dev/log");

host1:/home # ll
drwxr-xr-x 4 root root 4096 Sep 30 17:05 user

host:/home/user # ll -ls
4 drwxr-xr-x 2 root root 4096 Sep 30 17:05 dev
4 drwx- ----- 2 user users 4096 Oct 12 11:08 upload

The user walks on the key. Uploads files to the upload folder via sftp using the WinSCP client.

You get the following.

— 1 user users 5779 Sep 20 15:18 small-bankovskoe-delo.jpg
— 1 user users 6584 Sep 20 15:18 small-bek-ofis.jpg
— 1 user users 15405 Sep 20 15:18 small_aktivn_stoim_invest.jpg

cat /etc /profile

umask 077

What could be the problem with creating files WITHOUT PERMISSIONS?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
shadowalone, 2011-10-31
@shadowalone

This is due to the fact that non-login non-interactive shells are created for the sftp session. For such a shell, the settings are taken from the ~/.bashrc file. To change the umask for the sftp session, edit the ~/.bashrc file as follows - find and comment on the following line (the line is at the beginning of the file):
#[ -z "$PS1" ] && return
Instead, write the following code (set the umask value that you need): After that, connect via sftp, create a directory and look with what rights it was created: We see that the rights correspond to the set umask 0007 parameter.
if [ -z "$PS1" ]; then
umask 0007
return
fi

sftp> mkdir test
sftp> ls -l
...
drwxrwx--- 2 user user 4096 Feb 22 16:57 test
...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question