Tuesday, March 26, 2024

sftp server empty password login

I have been using the secure shell for remote maintenance
on my local machine for some time. I wish to go one step
further and implement a secure file transfer server, where
user(s) could download files from a read-only /home/media
directory as well as upload their own files to /home/media/pub

Ideally this would be done via passwordless/empty password login.
I have done some research (manpages) and configuration but still
fail to connect from another machine on the same local network.

obsd configuration :

# useradd -g media -s /sbin/nologin -u 2000 -v media
# usermod -G media sylvain

$ more /etc/ssh/sshd_config # relevant extracts and changes :
...
PermitRootLogin no
...
# override default of no subsystems
#Subsystem sftp /usr/libexec/sftp-server -d /home/media
Subsystem sftp internal-sftp # -d /home/media

Match User media
ForceCommand internal-sftp -d /home/media
ChrootDirectory /home/media
PasswordAuthentication yes
AuthenticationMethods none
PermitEmptyPasswords yes

$ ll -d /home/media /home/media/pub
drwxr-xr-x 16 root wheel 512 Mar 25 17:42 /home/media/
drwxr-xr-x 3 media media 512 Mar 25 17:42 /home/media/pub/

failed connexion attempt from second local machine
(just pressing Enter at password prompt):

Last login: Tue Mar 26 09:46:37 on ttys001
sylvain@sylvainmac ~ % sftp media@10.0.0.11
media@10.0.0.11's password:
Permission denied, please try again.
media@10.0.0.11's password:
Permission denied, please try again.
media@10.0.0.11's password:
media@10.0.0.11: Permission denied ().
Connection closed
sylvain@sylvainmac ~ %

Attempting to login using a password (after definition using
`# passwd media') does not work either. What am I doing wrong ?
Thank you
--
Sylvain Saboua
www.saboua.xyz

No comments:

Post a Comment