Ahoj,
na starem proftpd jsem se s tim nesetkal, tak na to nemuzu prijit.
sftp> ls -aln
drwx------ ? 2001 2001 4096 Aug 29 14:20 .
drwx------ ? 2001 2001 4096 Aug 29 14:20 ..
sftp> put /tmp/sftp_test.txt
Uploading /tmp/sftp_test.txt to /sftp_test.txt
dest open "/sftp_test.txt": Permission denied
sftp> ls -aln
drwx------ ? 2001 2001 4096 Aug 29 14:21 .
drwx------ ? 2001 2001 4096 Aug 29 14:21 ..
-rw-r--r-- ? 2001 2001 0 Aug 29 14:21 sftp_test.txt
sftp> put /tmp/sftp_test.txt
Uploading /tmp/sftp_test.txt to /sftp_test.txt
sftp_test.txt 100% 6 3.9KB/s 00:00
sftp> ls -aln
drwx------ ? 2001 2001 4096 Aug 29 14:21 .
drwx------ ? 2001 2001 4096 Aug 29 14:21 ..
-rw-r--r-- ? 2001 2001 6 Aug 29 14:21 sftp_test.txt
sftp> ^D
Bez ohledu na slozku, kdykoli se pokusim nahrat soubor, co neexistuje, tak se soubor na sftp vytvori s velikosti 0 B a hodi to chybu. Kdyz zkusim nahrat soubor napodruhe, tak uz nema problem nahrat i obsah souboru. Netusi nekdo, v cem je zadrhel? Slozky lze vytvaret rovnou.
Nejake ty zmenove konfigy od defaultu:
<Global>
#AllowOverwrite on
CreateHome on dirmode 0750 uid 2001 gid 2001
DefaultChdir /srv/sftp
DefaultRoot ~
RequireValidShell off
</Global>
<VirtualHost 0.0.0.0>
ServerName SOMEFQDN
Port 2222
Umask 0022 0002
AllowOverwrite on
<IfModule mod_sftp.c>
MaxLoginAttempts 6
SFTPAuthMethods publickey
SFTPEngine on
SFTPHostKey /etc/ssh/ssh_host_rsa_key
SFTPHostKey /etc/ssh/ssh_host_ed25519_key
<IfModule mod_sftp_sql.c>
# Instead of using a file-based key store, we tell mod_sftp to use the SQL-based key store provided by mod_sftp_sql
SFTPAuthorizedUserKeys sql:/get-user-authorized-keys
</IfModule>
#Limit use SITE_CHMOD
<Limit SITE_CHMOD>
DenyAll
</Limit>
<Directory / >
<Limit ALL>
DenyAll
</Limit>
</Directory>
<Directory /srv/sftp/ >
<Limit ALL>
AllowAll
</Limit>
</Directory>
</IfModule>
<IfModule mod_sql.c>
SQLBackend postgres
SQLConnectInfo proftpd@localhost SOMEUSER SOMEPASS
# Now that we have a default connection, we can create another connection, named "logdb" and using the "postgresql" backend, to the logdb database
SQLNamedConnectInfo logdb postgres proftpd@localhost SOMEUSER SOMEPASS
# Define a SELECT statement to retrieve user's authorized SSH keys
SQLNamedQuery get-user-authorized-keys SELECT "passwd FROM users_argon2 WHERE userid='%U' AND locked=false"
# Define a SELECT statement to retrieve user's info
SQLNamedQuery get-user-by-name SELECT "userid, passwd, uid, gid, homedir, shell FROM users_argon2 WHERE userid = '%U' AND locked=false"
SQLUserInfo custom:/get-user-by-name
SQLGroupInfo public.groups groupname gid members
# SQLNamedQuery get-group-by-name SELECT "groupname, gid, members from groups where members= '%U'"
# SQLGroupInfo custom:/get-group-by-name
# Update the users.last_accessed column on successful login in the userdb
SQLNamedQuery last_accessed UPDATE "last_accessed=NOW() WHERE userid='%u'" users
#SQLLog PASS last_accessed
# Add a row to the login_history table on successful login in the logdb
SQLNamedQuery log_sess FREEFORM "INSERT INTO login_history (userid, client_ip, server_ip, protocol, date) VALUES ('%u, '%a', '%V', '%{protocol}', NOW())" logdb
#SQLLog PASS log_sess
#SQLLog PASS *
SQLLogFile /var/log/proftpd/sql.log
</IfModule>
<IfGroup test>
# <IfUser pubkey>
<Limit Login>
Order allow, deny
# Deny from SOMEIP
</Limit>
# </IfUser>
</IfGroup>
</VirtualHost>