A
A
Alexander2018-08-08 16:54:04
linux
Alexander, 2018-08-08 16:54:04

sftp permissions?

Hello, the problem with sftp created user test and the folder /home/test/upload, the rights to the folder test(drwxr-xr-x root root ) to upload (drwxr-xr-x test test ), when connecting via sftp, there are no rights to create or changing files in the upload folder.
I tried to give full rights to the folder chmod 777 /home/test/upload result 0.
sftp config

#	$OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $



Port 22
Protocol 2
SyslogFacility AUTHPRIV
LogLevel INFO
AuthorizedKeysFile	%h/.ssh/authorized_keys
PasswordAuthentication yes
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
UsePAM yes
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS
X11Forwarding no

PermitRootLogin no
Subsystem sftp internal-sftp 
Match User test
RSAAuthentication yes
PubkeyAuthentication yes

ChrootDirectory %h/upload

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2018-08-15
@seriousdarl

anyone interested in the solution to the problem:
ChrootDirectory %h
chown root:test /home/test
chmod 755 /home/test
inside the folder with upload (drwxr-xr-x test test ),
and cut down setenforce 0

A
Alexander, 2018-08-08
Madzhugin @Suntechnic

On the one hand, everything is correct. On the other hand, it is strange that ssh works for you at all, in conditions when the home directory does not belong to the user. How did you even come up with this?
Look at the thing - if the home directory does not belong to the user and if the ~/.ssh directory does not belong to the user and (this is important) has rights other than drwx ------ there is nothing to hope that ssh and everything that is wrapped in it (tunnels, sftp, etc.) will work correctly.
What is the purpose of such cutting rights?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question