openssh-server setup in Debian 11
Install open-ssh server:
sudo apt install -y openssh-server
Start sftp server:
systemctl start sshd
Check status of sftp:
systemctl status sshd
Create a base directory:
sudo mkdir /srv/sftp
Create a group:
sudo groupadd sftpusers
Add a linux to sftp group - sftpgroups:
sudo useradd -G sftpusers -d /srv/sftp/limuxhelp1 -s /sbin/nologin linuxhelp1
Add password for user:
sudo passwd linuxhelp1
Enter password two times and press enter
Now enable the password authentication in sshd configuration:
sudo vi /etc/ssh/sshd_config
After opening the file search for "PasswordAuthentication yes". It should be uncommented.
Now have to add Rule for the users in secure FTP users group:
sudo vi /etc/ssh/sshd_config
Add below lines in the last of the file:
Match Group sftpusers
X11Forwarding no
AllowTcpForwarding no
ChrootDirectory /srv/sftp #<your custom directory>
ForceCommand internal-sftp
Now restart the sshd server:
Systemctl restart sshd
Check status of sftp:
systemctl status sshd
Now test the server:
~# sftp linuxhelp1@192.168.1.226 #<Here add your system ip address>
No comments:
Post a Comment