Ssh is not installed in the newly installed Ubuntu system by default. If you have not installed the ssh service, but you cannot connect to ubuntu through ssh directly on the client, run the following command:
The Code is as follows: |
Copy code |
$ Sudo apt-get install openssh-server |
Install the SSH server and client
The Code is as follows: |
Copy code |
Sudo apt-get install openssh-server openssh-client |
Copy files/folders from remote Ubuntu to local (scp)
The Code is as follows: |
Copy code |
Scp-r username@192.168.0.1:/home/username/remotefile.txt. |
Copy files/folders from local computer to remote Ubuntu machine (scp)
The Code is as follows: |
Copy code |
Scp-r localfile.txt username@192.168.0.1:/home/username/ |
Copy files/folders from a remote Ubuntu machine to a local machine (rsync)
The Code is as follows: |
Copy code |
Rsync-v-u-a -- delete -- rsh = ssh -- stats username@192.168.0.1:/home/username/remotefile.txt. |
Copy files/folders from local computer to remote Ubuntu machine (rsync)
The Code is as follows: |
Copy code |
Rsync-v-u-a -- delete -- rsh = ssh -- stats localfile.txt username@192.168.0.1:/home/username/ |
It's super simple.
Other parameters
To enable the SSH service on the local machine, you need to install openssh-server:
The Code is as follows: |
Copy code |
Sudo apt-get install openssh-server |
Check whether sshserver is running:
The Code is as follows: |
Copy code |
Ps-e | grep ssh |
Run sshserver:
The Code is as follows: |
Copy code |
Sudo/etc/init. d/ssh start |
The ssh-server configuration file is located in/etc/ssh/sshd_config. You can customize the SSH service port.
The default port is 22. Restart the SSH service after the custom Port:
The Code is as follows: |
Copy code |
Sudo/etc/init. d/ssh stop Sudo/etc/init. d/ssh start |
Log on to SSH:
The Code is as follows: |
Copy code |
Ssh username @ localhost The username is the user on the localhost machine and the password is required. |
Disconnect:
Exit