Setting up an sftp server..


Establishing a sftp server with only access to sftp(no access to shell)


QuickGo


step1--Enable ssh

step2--turn firewall of on the port 22(or any static port you set for ssh)

step3--create users/groups and setting up passwords for created users

step4--create folders for the users to upload and download files( land on)(set permissions accordingly)

step5--Edit the sshd_config file to set the users permissions

step6--restart the sshd service

step7--login with your user..

Step by step procedures are as follows::::::

 (note:::here i am using ubuntu as my server)


--Step1

First install ssh (ignore if already installed)

use command:-

"apt-get install openssh-server"

--Step 2

Disable blocking by firewall on port 22 .(since it is the default port for ssh)

use command:

"ufw allow ssh"

--Step3

Now comes the main part,

Create users 

(here i created 5 users two in one group and two in other the 5th one in both)


now check whether they are created



now create groups,
use command:
"sudo addgroup groupname"

now add users to the group

                                         



to know in which group the user is ;

use command:

"groups username"


now set passwords for the users




--Step 4

creating directories 




(similarly i have created /sftp2 for groupb)




now open the directory and make a new directory inside it  for the user.
 now set owners for the directories






(any one of the user of the group can be the owner of the user directory )
(root should be the owner of /sftp directory where users land.)


now set the permissions for the directories 
"sudo chmod 755 /sftp"
"sudo chmod 755 /sftp2"
"sudo chmod 775 /sftp/landa"
"sudo chmod 775 /sftp2/land"
  

(one of the outcome)




--Step5
    Edit the sshd_config file
      open the file 
      "sudo nano /etc/ssh/sshd_config"

                              then edit as follows:



save and exit..


--Step6 
Restart sshd service
"sudo systemctl restart sshd.service"







--Step7
Congrats!!sftp is configured for these users..
now check the connection by loging in




now try to login with a client system



What happens if we use these users for ssh?





Using a sftp client (firezilla)

after using the client we can see on our server which user added what file ..





-------------------------------------------------------THE END------------------------------------------------------------


Comments

Popular posts from this blog