FTP and SSH connection remote terminal Ubuntu

After installing ubuntu, there is no ssh service and ftp service by default. We need to solve this problem by ourselves.

SSH

Update software list and software

sudo apt-get update
sudo apt-get upgrade

install ssh

sudo apt-get install ssh

start ssh service

sudo /etc/init.d/ssh start

Modify the ssh service configuration file

sudo vim /etc/ssh/sshd_config

Find the configuration item and modify it to (this item is to allow root login)

PermitRootLogin yes

Modify the root password, I don’t know why you can’t log in as root without modifying it

sudo passwd root

Restart the ssh service after modification

service sshd restart  # 或者
/etc/initd.d/sshd restart

FTP

Install ftp service

sudo apt-get install vsftpd

Modify the ftp configuration file

sudo vim /etc/vsftpd.conf

Find the configuration item and modify it to

local_enable=YES
write_enable=YES

Modify the ftp configuration file. This configuration file needs to comment out the root user so that root can log in.

sudo vim /etc/ftpusers

Restart the ftp service after modification

service vsftpd restart  # 或者
/etc/initd.d/vsftpd restart

open port

Both ftp and ssh require ports. The default port for ftp is 21, and the default port for ssh is 22. These ports are closed by default in the firewall, and we need to open them manually.


sudo ufw allow 20/tcp
sudo ufw allow 21/tcp
sudo ufw allow 22/tcp

You also need to restart the service after opening the port

terminal connection

After setting these, we can connect to our server in terminal software such as xft and xshell.

The address of the host can ifconfogbe viewed from the host with the command

xftp settings

image-20230521195249854

xshell settings

image-20230521195258302

Guess you like

Origin blog.csdn.net/weixin_43903639/article/details/130795827