ftp-rol sftp-re virtualis userekkel prftpd alatt

Fórumok

Sziasztok,

megoldhato sftp ftp helyett (vagy mint extra) virtualis userekkel proftpd alatt?
http://giantdorks.org/alain/ftp-server-with-virtual-users-on-debian-len…
szerint installaltam egy szervert, felraktam es konfiguraltam a proftpd-t.
ftp mukodik.
sftp-re szeretnek valtani.
Megoldhato ez anelkul, hogy system usereket hozzak letre?

http://blog.smile.fr/Using-sftp-with-proftpd emlit valamit a valtasrol ftp-rol sft-re, de szerinte szukseges a hasonlo nevu system userek letrehozasa.

ardi

Hozzászólások

Megoldható, csináltam ilyet. System user ahhoz kell, hogy annak a nevében férhessen a fájlrendszerhez.

epp azt akartam elkerulni, hogy klasszikus system userek letezzenek
sajat /home/user1, /home/user2 konyvtarakkal.
hogy hozzam oket letre, hogy ne legyen sajat /home/ konyvtaruk?

Azert szeretnem letrehozni a virtualis usereket, hogy csak a sajat
/var/ftp/user1, /var/ftp/user2 konyvtarukhoz ferjenek hozza.

megoldhato, nem kell system-user. teljesen ugy mukodik mint a normal ftp. en mysql-bol azonositom a felhasznalokat es a szinten ott tarolt konyvtarba vroot-olom belepes utan az adott felhasznalot.
az sftp-hez (itt a proftpd sftp moduljarol beszelek) tartozo virtualhost config-ba kell ez, ha mashol bekapcsoltad a tlsengine-t, kulonben nem fog jol authentikalni:

TLSEngine off
# (ha ftps-t is hasznalsz akkor ott az sftpengine-t kell off-ba tenni)
SFTPEngine on
Port 22

tovabbi beallitasok az sql-auth-hoz:

Include /etc/proftpd/conf.d/sql.conf
SQLAuthenticate on
DefaultRoot ~
SQLAuthTypes OpenSSL
AuthOrder mod_sql.c*

ha egyebkent mukodik az sql-bol authentikalas, akkor itt is fog mukodni. uid, gid is lehet user-enkent az sql-ben fuggetlenul attol, hogy rendszerszinten nem leteznek, csak az esetleges utkozesekre kell odafigyelni.

szerk.

elobb irok aztan olvasok. szoval ez kell neked sql-auth helyett:

AuthUserFile /etc/proftpd.passwd
AuthOrder mod_auth_file.c

brr...ez meg jobban kezd bonyolodni :-)
vhogy ki szeretnem hagyni, ha lehet, ezt a mysql-t....

probaltam a http://blog.uni.cl/2014/02/using-sftp-with-proftpd/
oldalon az elso metodust, de imet belebonyolodtam vmibe:

Now create the new virtual user and map his UID and GID on an existing user (i.e. www-data, 33:33):

vi /etc/proftpd/sftp.passwd

virtual1:HASSSSSHHHH:33:33::/var/www/magento/medias:/bin/bash

itt is letezo system user UID,GID-jet hasznalva kell letrehozni
a virtual1 sort.

NEM mukodott. :-(

nem tudok rajonni, hogyan tudnek virtualis user1, user2 felhasznalok
reszere sftp-t konfiguralni sajat konyvtarakkal.

ne bonyolitsd tul.
1 (egy) darab system uid es egy gid kell minden felhasznalodnak, akar a nobody/nogroup is lehet.

amit irtal password-file sort az teljesen jonak tunik. a masik felhasznalo pont igy fog kinezni, csak:

'virtual1' helyett 'virtual2'
'/var/www/magento/medias' helyett pl '/var/www/weboldal2'

jelszot ertelemszeruen allitasz es keszen vagy.

kicsit bovebben, hogy mi nem mukodott? nem tudtal bejelentkezni vagy nem oda leptetett be ahova kellett volna?

Sziasztok mindenkinek,

sikerult a fenti hozzaszolasokbol kiokumlalnom valamit es a kovetkezot ertem el.
Amikor az FTP mukodott, az /etc/proftpd/proftpd.conf
tartalmazta a kovetkezo sort:
AuthUserFile /etc/proftpd/passwd

ls -ltr /etc/proftpd/passwd:
-r--r----- 1 root root 156 Oct 30 10:06 passwd
cat /etc/proftpd/passwd:
(xxx = jelszo atirva)
user1:xxx:111:65534::/var/ftp/user1:/bin/false
user2:xxx:111:65534::/var/ftp/user2:/bin/false

Atterve SFTP-re es hasznalva http://blog.uni.cl/2014/02/using-sftp-with-proftpd/ oldalrol:


SFTPEngine on

Port 2222
SFTPLog /var/log/proftpd/sftp.log
TransferLog /var/log/proftpd/sftp-xferlog

# Host Keys
SFTPHostKey /etc/ssh/ssh_host_rsa_key
SFTPHostKey /etc/ssh/ssh_host_dsa_key

# Auth methods
SFTPAuthMethods password
AuthUserFile /etc/proftpd/sftp.passwd

# SFTP specific configuration
DefaultRoot ~

beallitasokat

es
cat sftp.passwd
user1:xxx:111:65534::/var/ftp/user1:/bin/false
user2:xxx/:111:65534::/var/ftp/user2:/bin/false

ls -lrt|grep sftp
-r--r----- 1 root root 156 Nov 2 08:03 sftp.passwd

Bocsi a kovetkezo sorokert - nem tudom, hogyan kopirozzam ide a teljes
/etc/proftpd/proftpd.conf fajlt, amely <, > tagokat tartalmaz - ez alant
nem lathato:


cd /etc/proftpd
cat proftpd.conf|grep -v '^$'|grep -v ^\#
Include /etc/proftpd/modules.conf
UseIPv6                         on
IdentLookups                    off
ServerName                      "Debian"
ServerType                      standalone
DeferWelcome                    off
MultilineRFC2228                on
DefaultServer                   on
ShowSymlinks                    on
TimeoutNoTransfer               600
TimeoutStalled                  600
TimeoutIdle                     1200
DisplayLogin                    welcome.msg
DisplayChdir                    .message true
ListOptions                     "-l"
DenyFilter                      \*.*/
DefaultRoot                     ~
RequireValidShell               off
SFTPEngine         on
Port                            2222
<IfModule mod_dynmasq.c>
</IfModule>
MaxInstances                    30
User                            proftpd
Group                           nogroup
Umask                           022  022
AllowOverwrite                  on
TransferLog /var/log/proftpd/sftp-xferlog
SFTPLog            /var/log/proftpd/sftp.log
SFTPHostKey        /etc/ssh/ssh_host_rsa_key
SFTPHostKey        /etc/ssh/ssh_host_dsa_key
SFTPAuthMethods    password
AuthUserFile       /etc/proftpd/sftp.passwd
<IfModule mod_quotatab.c>
QuotaEngine off
</IfModule>
<IfModule mod_ratio.c>
Ratios off
</IfModule>
<IfModule mod_delay.c>
DelayEngine on
</IfModule>
<IfModule mod_ctrls.c>
ControlsEngine        off
ControlsMaxClients    2
ControlsLog           /var/log/proftpd/controls.log
ControlsInterval      5
ControlsSocket        /var/run/proftpd/proftpd.sock
</IfModule>
<IfModule mod_ctrls_admin.c>
AdminControlsEngine off
</IfModule>
<Limit LOGIN>
   AllowUser user1
   AllowUser user2
   DenyALL
</Limit>
<Directory /var/ftp/user1/read>
    <Limit ALL>
        DenyAll
    </Limit>
    <Limit DIRS READ>
        AllowUser user1
    </Limit>
</Directory>
<Directory /var/ftp/user1/write>
    <Limit ALL>
        DenyAll
    </Limit>
    <Limit DIRS READ WRITE>
        AllowUser user1
    </Limit>
</Directory>
<Directory /var/ftp/user2/read>
    <Limit ALL>
        DenyAll
    </Limit>
    <Limit DIRS READ>
        AllowUser user2
    </Limit>
</Directory>
<Directory /var/ftp/user2/write>
    <Limit ALL>
        DenyAll
    </Limit>
    <Limit DIRS READ WRITE>
        AllowUser user2
    </Limit>
</Directory>
Include /etc/proftpd/conf.d/

majd: systemctl start proftpd (vagy /etc/init.d/proftpd start)

Eredmeny:miutan 2 file-t kopiroztam wscp-vel a 2222-es porton keresztul
a szerverre jelentkezve /var/ftp/user1 konyvtarba:

cd /var/log/proftpd/

ls -ltr|grep sftp
-rw-r--r-- 1 root root 214 Nov 2 08:06 sftp-xferlog
-rw-r----- 1 root root 5293 Nov 2 08:06 sftp.log

cat sftp-xferlog
Mon Nov 02 07:46:54 2015 1 10.237.178.126 8607159 /var/ftp/user1/cmandsuu.wmv b _ i r user1 sftp 0 * c
Mon Nov 02 08:06:14 2015 18 10.237.178.126 100000000 /var/ftp/user1/file111_100MBfile b _ i r user1 sftp 0 * c

cat sftp.log (itt csak a 2. bejelentkezest kopirozom ide):

2015-11-02 08:04:14,081 mod_sftp/0.9.9[973]: error using DisplayLogin 'welcome.msg': No such file or directory
2015-11-02 08:04:14,083 mod_sftp/0.9.9[973]: sent server version 'SSH-2.0-mod_sftp/0.9.9'
2015-11-02 08:04:14,102 mod_sftp/0.9.9[973]: received client version 'SSH-2.0-WinSCP_release_5.1.5'
2015-11-02 08:04:14,102 mod_sftp/0.9.9[973]: handling connection from SSH2 client 'WinSCP_release_5.1.5'
2015-11-02 08:04:14,103 mod_sftp/0.9.9[973]: + Session key exchange: diffie-hellman-group-exchange-sha1
2015-11-02 08:04:14,103 mod_sftp/0.9.9[973]: + Session server hostkey: ssh-rsa
2015-11-02 08:04:14,103 mod_sftp/0.9.9[973]: + Session client-to-server encryption: aes256-ctr
2015-11-02 08:04:14,103 mod_sftp/0.9.9[973]: + Session server-to-client encryption: aes256-ctr
2015-11-02 08:04:14,103 mod_sftp/0.9.9[973]: + Session client-to-server MAC: hmac-sha1
2015-11-02 08:04:14,103 mod_sftp/0.9.9[973]: + Session server-to-client MAC: hmac-sha1
2015-11-02 08:04:14,103 mod_sftp/0.9.9[973]: + Session client-to-server compression: none
2015-11-02 08:04:14,103 mod_sftp/0.9.9[973]: + Session server-to-client compression: none
2015-11-02 08:04:17,084 mod_sftp/0.9.9[973]: sending acceptable userauth methods: password
2015-11-02 08:04:22,178 mod_sftp/0.9.9[973]: no supplemental groups found for user 'user1'
2015-11-02 08:04:22,181 mod_sftp/0.9.9[973]: sending userauth success
2015-11-02 08:04:22,181 mod_sftp/0.9.9[973]: user 'user1' authenticated via 'password' method
2015-11-02 08:04:22,182 mod_sftp/0.9.9[973]: client sent SSH_MSG_IGNORE message (176 bytes)
2015-11-02 08:04:22,185 mod_sftp/0.9.9[973]: unsupported 'simple@putty.projects.tartarus.org' channel requested, ignoring
2015-11-02 08:04:22,225 mod_sftp/0.9.9[973]: 'subsystem' channel request for 'sftp' subsystem
2015-11-02 08:04:22,292 mod_sftp/0.9.9[973]: using SFTP protocol version 5 for this session (channel ID 0)
2015-11-02 08:04:22,295 mod_sftp/0.9.9[973]: client sent 'vendor-id' extension: { vendorName = 'Martin Prikryl', productName = 'WinSCP', productVersion = '5.1.5', buildNumber = 3261 }
2015-11-02 08:06:14,717 mod_sftp/0.9.9[973]: client set access time of '/file111_100MBfile' to Wed Aug 26 06:33:38 2015
2015-11-02 08:06:14,717 mod_sftp/0.9.9[973]: client set modification time of '/file111_100MBfile' to Wed Aug 26 06:33:38 2015
2015-11-02 08:06:16,546 mod_sftp/0.9.9[973]: LSTAT of '/write' blocked by configuration
2015-11-02 08:06:27,768 mod_sftp/0.9.9[973]: LSTAT of '/read' blocked by configuration
2015-11-02 08:06:31,322 mod_sftp/0.9.9[973]: LSTAT of '/write' blocked by configuration
2015-11-02 08:06:36,538 mod_sftp/0.9.9[973]: disconnecting client (received EOF)

Most mar csak azt nem ertem, miert nem tudok /var/ftp/user1/write konyvtarba kopirozni?

UJ: Mukodik ez is - nem ertem mi volt a bibi.
/var/ftp/user1/read, /var/ftp/user2/read nem engedelyezve irasra - ugyhogy
OK a hibauzenet mindket esetben:


2015-11-02 09:53:13,794 mod_sftp/0.9.9[1043]: client set access time of '/write/file5_100MBfile' to Wed Aug 26 06:33:38 2015
2015-11-02 09:53:13,794 mod_sftp/0.9.9[1043]: client set modification time of '/write/file5_100MBfile' to Wed Aug 26 06:33:38 2015
2015-11-02 09:53:39,581 mod_sftp/0.9.9[1043]: client set access time of '/file6_100MBfile' to Wed Aug 26 06:33:38 2015
2015-11-02 09:53:39,581 mod_sftp/0.9.9[1043]: client set modification time of '/file6_100MBfile' to Wed Aug 26 06:33:38 2015
2015-11-02 09:53:46,155 mod_sftp/0.9.9[1043]: OPEN command for '/read/file6_100MBfile' blocked by 'STOR' handler
2015-11-02 09:53:46,157 mod_sftp/0.9.9[1043]: LSTAT of '/read/file6_100MBfile' blocked by configuration

2015-11-02 09:55:03,152 mod_sftp/0.9.9[1058]: client set access time of '/ucarp-1.5.2.tar.gz' to Thu Oct 1 12:41:12 2015
2015-11-02 09:55:03,152 mod_sftp/0.9.9[1058]: client set modification time of '/ucarp-1.5.2.tar.gz' to Thu Oct 1 12:41:26 2015
2015-11-02 09:55:06,824 mod_sftp/0.9.9[1058]: client set access time of '/write/ucarp-1.5.2.tar.gz' to Thu Oct 1 12:41:12 2015
2015-11-02 09:55:06,824 mod_sftp/0.9.9[1058]: client set modification time of '/write/ucarp-1.5.2.tar.gz' to Thu Oct 1 12:41:26 2015
2015-11-02 09:55:10,919 mod_sftp/0.9.9[1058]: OPEN command for '/read/ucarp-1.5.2.tar.gz' blocked by 'STOR' handler
2015-11-02 09:55:10,922 mod_sftp/0.9.9[1058]: LSTAT of '/read/ucarp-1.5.2.tar.gz' blocked by configuration
2015-11-02 09:55:16,718 mod_sftp/0.9.9[1058]: disconnecting client (received EOF)

Ardi

igen, letrehozhato ilyen konfiguracio. a 'virtualhost' direktiva leirasat nezd at.

elso korben en a limit-es reszeket kihagynam teljesen a config-bol. ha minden user a sajat konyvtaraba ir csak, akkor nincs jelentosege a chroot megoldja. igen, elvileg ad plusz biztonsagot, de tesztre boven jo.

a var/ftp/[user1|user2] konyvtarak jogai egyebkent rendben vannak? tehat a tulajdonos a 111-es uid a csoport pedig a 65534?

Ugy nez ki, hogy a /var/ftp/user[1|2] konyvtarak jogai jok:

ls -n
total 8
drwxrwx--- 4 111 65534 4096 Nov 2 09:55 user1
drwxrwx--- 4 111 65534 4096 Nov 2 10:22 user2

Felhasznalva http://www.proftpd.org/docs/contrib/mod_sftp.html#SFTPAndFTP
infot update-eltem az /etc/proftpd/proftpd.conf
fajlt a kovetkezo sorokkal: (az elozo sftp beallitasokat toroltem)


<IfModule mod_sftp.c>
<VirtualHost 0.0.0.0>
SFTPEngine on
Port 2222
SFTPLog /var/log/proftpd/sftp.log
TransferLog /var/log/proftpd/sftp-xferlog
SFTPHostKey /etc/ssh/ssh_host_rsa_key
SFTPHostKey /etc/ssh/ssh_host_dsa_key
SFTPAuthMethods password
AuthUserFile /etc/proftpd/sftp.passwd
MaxLoginAttempts 6
DefaultRoot ~
</VirtualHost>
</IfModule>

majd systemctl start proftpd utan wscp-re probalok a 2222-es porton mint user1 bejelentkezni, amit azonban nem enged:


cat sftp.log
.
.
.
2015-11-02 11:55:19,369 mod_sftp/0.9.9[2785]: sent server version 'SSH-2.0-mod_sftp/0.9.9'
2015-11-02 11:55:19,380 mod_sftp/0.9.9[2785]: received client version 'SSH-2.0-WinSCP_release_5.1.5'
2015-11-02 11:55:19,380 mod_sftp/0.9.9[2785]: handling connection from SSH2 client 'WinSCP_release_5.1.5'
2015-11-02 11:55:19,382 mod_sftp/0.9.9[2785]: + Session key exchange: diffie-hellman-group-exchange-sha1
2015-11-02 11:55:19,382 mod_sftp/0.9.9[2785]: + Session server hostkey: ssh-rsa
2015-11-02 11:55:19,382 mod_sftp/0.9.9[2785]: + Session client-to-server encryption: aes256-ctr
2015-11-02 11:55:19,382 mod_sftp/0.9.9[2785]: + Session server-to-client encryption: aes256-ctr
2015-11-02 11:55:19,382 mod_sftp/0.9.9[2785]: + Session client-to-server MAC: hmac-sha1
2015-11-02 11:55:19,382 mod_sftp/0.9.9[2785]: + Session server-to-client MAC: hmac-sha1
2015-11-02 11:55:19,382 mod_sftp/0.9.9[2785]: + Session client-to-server compression: none
2015-11-02 11:55:19,382 mod_sftp/0.9.9[2785]: + Session server-to-client compression: none
2015-11-02 11:55:22,075 mod_sftp/0.9.9[2785]: sending acceptable userauth methods: password
2015-11-02 11:55:26,413 mod_sftp/0.9.9[2785]: authentication for user 'user1' failed: Invalid shell
2015-11-02 11:55:26,413 mod_sftp/0.9.9[2785]: sending userauth failure; remaining userauth methods: password
2015-11-02 11:55:26,414 mod_sftp/0.9.9[2785]: client sent SSH_MSG_IGNORE message (176 bytes)
2015-11-02 11:55:28,813 mod_sftp/0.9.9[2785]: disconnecting client (received EOF)

UJ: 13:38 ================================================

Segitett egy sor betoldasa a virtual reszben:
RequireValidShell off


<IfModule mod_sftp.c>
<VirtualHost 0.0.0.0>
SFTPEngine on
Port 2222
SFTPLog /var/log/proftpd/sftp.log
TransferLog /var/log/proftpd/sftp-xferlog
SFTPHostKey /etc/ssh/ssh_host_rsa_key
SFTPHostKey /etc/ssh/ssh_host_dsa_key
SFTPAuthMethods password
AuthUserFile /etc/proftpd/sftp.passwd
RequireValidShell off
MaxLoginAttempts 6
DefaultRoot ~
</VirtualHost>
</IfModule>

majd systemctl start proftpd utan wscp-re probalok a 2222-es porton mint user2 bejelentkezni - mukodik.

Egy kis megkotessel, ujonnan letezo fajlt meeg nem tudok atirni... :-(

2015-11-02 12:36:36,607 mod_sftp/0.9.9[3392]: received client version 'SSH-2.0-WinSCP_release_5.1.5'
2015-11-02 12:36:36,607 mod_sftp/0.9.9[3392]: handling connection from SSH2 client 'WinSCP_release_5.1.5'
2015-11-02 12:36:36,608 mod_sftp/0.9.9[3392]: + Session key exchange: diffie-hellman-group-exchange-sha1
2015-11-02 12:36:36,608 mod_sftp/0.9.9[3392]: + Session server hostkey: ssh-rsa
2015-11-02 12:36:36,608 mod_sftp/0.9.9[3392]: + Session client-to-server encryption: aes256-ctr
2015-11-02 12:36:36,608 mod_sftp/0.9.9[3392]: + Session server-to-client encryption: aes256-ctr
2015-11-02 12:36:36,608 mod_sftp/0.9.9[3392]: + Session client-to-server MAC: hmac-sha1
2015-11-02 12:36:36,608 mod_sftp/0.9.9[3392]: + Session server-to-client MAC: hmac-sha1
2015-11-02 12:36:36,608 mod_sftp/0.9.9[3392]: + Session client-to-server compression: none
2015-11-02 12:36:36,608 mod_sftp/0.9.9[3392]: + Session server-to-client compression: none
2015-11-02 12:36:39,747 mod_sftp/0.9.9[3392]: sending acceptable userauth methods: password
2015-11-02 12:36:43,876 mod_sftp/0.9.9[3392]: no supplemental groups found for user 'user2'
2015-11-02 12:36:43,877 mod_sftp/0.9.9[3392]: sending userauth success
2015-11-02 12:36:43,877 mod_sftp/0.9.9[3392]: user 'user2' authenticated via 'password' method
2015-11-02 12:36:44,857 mod_sftp/0.9.9[3392]: client sent SSH_MSG_IGNORE message (176 bytes)
2015-11-02 12:36:44,858 mod_sftp/0.9.9[3392]: unsupported 'simple@putty.projects.tartarus.org' channel requested, ignoring
2015-11-02 12:36:44,859 mod_sftp/0.9.9[3392]: 'subsystem' channel request for 'sftp' subsystem
2015-11-02 12:36:44,967 mod_sftp/0.9.9[3392]: using SFTP protocol version 5 for this session (channel ID 0)
2015-11-02 12:36:44,969 mod_sftp/0.9.9[3392]: client sent 'vendor-id' extension: { vendorName = 'Martin Prikryl', productName = 'WinSCP', productVersion = '5.1.5', buildNumber = 3261 }
2015-11-02 12:37:00,084 mod_sftp/0.9.9[3392]: client set access time of '/scapy-2.3.1.zip' to Tue Oct 27 14:54:34 2015
2015-11-02 12:37:00,084 mod_sftp/0.9.9[3392]: client set modification time of '/scapy-2.3.1.zip' to Tue Oct 27 14:54:42 2015
2015-11-02 12:37:09,810 mod_sftp/0.9.9[3392]: OPEN command for '/ucarp-1.5.2.tar.gz' blocked by 'STOR' handler
2015-11-02 12:37:14,768 mod_sftp/0.9.9[3392]: OPEN command for '/ucarp-1.5.2.tar.gz' blocked by 'STOR' handler
2015-11-02 12:37:15,973 mod_sftp/0.9.9[3392]: client set access time of '/ucarp-1.5.2.tar.gz' to Thu Oct 1 12:41:12 2015
2015-11-02 12:37:15,973 mod_sftp/0.9.9[3392]: client set modification time of '/ucarp-1.5.2.tar.gz' to Thu Oct 1 12:41:26 2015
2015-11-02 12:37:24,392 mod_sftp/0.9.9[3392]: disconnecting client (received EOF)

beirtam mindket reszbe a


# VALID LOGINS
<Limit LOGIN>
AllowUser user1
AllowUser user2
DenyALL
</Limit>

# USER 1
<Directory /var/ftp/user1/read>
<Limit ALL>
DenyAll
</Limit>
<Limit DIRS READ>
AllowUser user1
</Limit>
</Directory>
<Directory /var/ftp/user1/write>
<Limit ALL>
DenyAll
</Limit>
<Limit DIRS READ WRITE>
AllowUser user1
</Limit>
</Directory>

# USER 2
<Directory /var/ftp/user2/read>
<Limit ALL>
DenyAll
</Limit>
<Limit DIRS READ>
AllowUser user2
</Limit>
</Directory>
<Directory /var/ftp/user2/write>
<Limit ALL>
DenyAll
</Limit>
<Limit DIRS READ WRITE>
AllowUser user2
</Limit>
</Directory>

Mukodik - egy ujabb bibivel:
SFTP alatt ha /var/ftp/user1 konyvtarba kopirozok, atirja a mar letezo fajlt:


2015-11-02 14:11:43,205 mod_sftp/0.9.9[1130]: error opening '/ucarp-1.5.2.tar.gz': File exists
2015-11-02 14:11:44,713 mod_sftp/0.9.9[1130]: client set access time of '/ucarp-1.5.2.tar.gz' to Thu Oct 1 12:41:12 2015
2015-11-02 14:11:44,713 mod_sftp/0.9.9[1130]: client set modification time of '/ucarp-1.5.2.tar.gz' to Thu Oct 1 12:41:26 2015

mig /var/ftp/user/write konyvtarban nem engedi:

2015-11-02 14:12:21,027 mod_sftp/0.9.9[1130]: error opening '/write/ucarp-1.5.2.tar.gz': File exists
2015-11-02 14:12:21,029 mod_sftp/0.9.9[1130]: LSTAT of '/write/ucarp-1.5.2.tar.gz' blocked by configuration

LSTAT parametert hozzaadva a /var/ftp/user1/write
illetve /var/ftp/user2/write konyvtarhoz segitett:

# VALID LOGINS
<Limit LOGIN>
AllowUser user1
AllowUser user2
DenyALL
</Limit>

# USER 1
<Directory /var/ftp/user1/read>
<Limit ALL>
DenyAll
</Limit>
<Limit DIRS READ>
AllowUser user1
</Limit>
</Directory>
<Directory /var/ftp/user1/write>
<Limit ALL>
DenyAll
</Limit>
<Limit DIRS READ WRITE LSTAT> #<------------- ITT!
AllowUser user1
</Limit>
</Directory>

# USER 2
<Directory /var/ftp/user2/read>
<Limit ALL>
DenyAll
</Limit>
<Limit DIRS READ>
AllowUser user2
</Limit>
</Directory>
<Directory /var/ftp/user2/write>
<Limit ALL>
DenyAll
</Limit>
<Limit DIRS READ WRITE LSTAT>#<------------- ITT!
AllowUser user2
</Limit>
</Directory>


2015-11-02 14:43:29,948 mod_sftp/0.9.9[1575]: error opening '/write/ucarp-1.5.2.tar.gz': File exists
2015-11-02 14:43:31,225 mod_sftp/0.9.9[1575]: client set access time of '/write/ucarp-1.5.2.tar.gz' to Thu Oct 1 12:41:12 2015
2015-11-02 14:43:31,225 mod_sftp/0.9.9[1575]: client set modification time of '/write/ucarp-1.5.2.tar.gz' to Thu Oct 1 12:41:26 2015
2015-11-02 14:43:52,437 mod_sftp/0.9.9[1575]: disconnecting client (received EOF)

Szia,
Bár senki nem kérdezte eddig, de azért felteszem: Biztos, hogy sftp-t szeretnél, és nem ftps-t?
Az SFTP a legjobb tudomásom szerint az ssh része ( https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol ) , míg az ftps az FTP ssl-el titkosított megoldása ( https://en.wikipedia.org/wiki/FTPS ).
Pont emiatt - mivel egy SSH szerű réteg kezeli - szükséges a létező user ( legalábbis authentikálhatónak kell lennie ) az SFTP-hez, míg FTPS-hez tudtommal nem szükséges.
Üdv,
LuiseX
Szerk: Természetesen, a tévedés jogát fenntartom :)

Én azért preferálom az SFTP-t az FTP és az FTPS helyett, mert ennek egy TCP port elegendő, nincs szívás az aktív/passzív móddal, és a vonatkozó tűzfal beállításokkal.

Ha az SSH kezeli aő SFTP-t, akkor valóban kell, hogy legyen minden egyes liginhiz egy felhasználó a rendszerben (fixme). De ha a Proftpd SFTP modulját használod, akkor egy felhasználó elegendő, úgyis chrootolja a bejelentkezéskor a beállított könyvtárba.

Nekem igy van beallitva az ssh_config-ban:

Ki kell kommentelni a sftp-server sort:

#Subsystem sftp /usr/lib/openssh/sftp-server

Majd hozzaadni valami ilyesmit az internal-sftp beallitasahoz:

Subsystem sftp internal-sftp
Match group ftpaccess
ChrootDirectory %h
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp -d %u

Ebben a peldaban a ftpaccess csoportban levo felhasznalok lephetnek be sftp-n keresztul.

Vannak bizonyos megkotesek, mint pl a chroot konyvtar a root tulajdonaban kell legyen, es azon belul vannak a felhasznalok szamara irhato konyvtarak. Ezen az oldalon talalsz reszletesebb leirast: SFTP chroot

Sic Transit Gloria Mundi

Be lehet allitani, hogy a sftp csak bizonyos csoportba tartozo felhasznalokra legyen ervenyes, pl. sftpgroup. Igy azon felhasznalok, akik ebben a csoportban vannak, azoknak megy a sftp, de akik nincsenek benne, azok ugyanugy belephetnek tovabbra is ssh-n (Mar ha ezt ertetted a remote management alatt).

Sic Transit Gloria Mundi

subs

### ()__))____________)~~~ #################
# "Ha én veletek, ki ellenetek?" # E130/Arch