Remote linux login through sftp/SSH in Ubuntu

Source: Internet
Author: User
Tags create directory ssh disk usage file permissions ssh port

SSH remote logon to linux


The procedure is as follows:

1. Install openssh-server in the new computer that requires remote access. This computer is a remote computer and your current computer is a local computer. If you use Ubuntu or other Linux versions, you have installed software that connects to a remote computer.

2. Remote computer software installation is complete. Enter:

Ssh username @ address

Here, username is the account name of the remote computer, and address is the IP address or domain name of the remote computer.

On weekdays, you want to log on to 192.168.1.2 with keir. You can use:

Sssh keir@192.168.1.13

If you do not know the IP address of the remote computer, you can click Network Monitor on the remote computer and select "connection information" to view the IP address information.

3. the first connection may prompt "the authenticity of the host can't be established ". It does not matter. Answer yes to connect and enter the password.

4. If you log on to a standard Shell session, the command line prompt is "user name @ remote computer name ".

To run a graphics program through SSH, you can use:

Ssh-X username @ address

After the connection, enter the program name. For example, start gedit and enter gedit. In addition, even if the program appears on your computer, it still runs on a remote computer. If you start OpenOffice or other complex graphics programs, there may be a delay of some time.

Another SSH connection is used to transmit files. The sftp command can implement this function. Using sftp to connect to a remote computer is the same as logging on to an ftp server. You can also use sftp in Nautilus and enter sftp: // address in the address bar of Nautilus. The system will prompt the user name and password. After the connection is complete, you can copy/delete files in Nautilus.


Sftp remote logon to linux

The syntax in Ubuntu 10.04 is as follows:


Sftp [-1Cv] [-B buffer_size] [-B batchfile] [-F ssh_config] [-o ssh_option] [-P sftp_server_path] [-R num_requests]


[-S program] [-s subsystem | sftp_server] host


Sftp [user @] host [: file...]


Sftp [user @] host [: dir [/]


Sftp-B batchfile [user @] host


The syntax in Ubuntu 10.10 is as follows:


Sftp [-1246 Cpqrv] [-B buffer_size] [-B batchfile] [-c cipher] [-D sftp_server_path] [-F ssh_config] [-I identity_file]


[-O ssh_option] [-P port] [-R num_requests] [-S program] [-s subsystem | sftp_server] host


Sftp [user @] host [: file...]


Sftp [user @] host [: dir [/]


Sftp-B batchfile [user @] host


The following is an example of www.111cn.net:


Login (after successful logon, the command line prompt will change to "sftp> ")


Sftp chen@100.130.100.99 # remotely log on to the 100.130.100.99 host as a chen user, the default port is 22


Sftp-o Port = 222 chen@100.130.100.99 # specify the SSH Port number to remotely log on to the host


Sftp-o Port = 222 chen@100.130.100.99:/home/chen/version/# specify the SSH Port number to remotely log on to the host and switch to the/home/chen/version/Directory


Sftp-P 222 chen@100.130.100.99 # specify the SSH port number to remotely log on to the host (this method can only be used in Ubuntu 10.10)


Note: You can run the following command only after logging on to the remote host.


Interactive command:


Upload


Put new.txt/home/chen/Logs: upload the new.txt file under the current directory to the/home/chen/directory of the remote host.


Download


Get/home/chen/new.txt # Download the/home/chen/new.txt file of the remote host to the local directory


Get/home/chen/new.txt/home/zhao/# Download the/home/chen/new.txt file of the remote host to the local/home/zhao/directory.


Remote command:


Switch Directory


Cd pro # switch to the pro Directory


Change permissions


Chmod 755 my-shell.sh # change my-shell.sh file permissions to 755


View disk usage


Df-h # View disk usage


List directory content


Ls-l # Display files and directories in a detailed list


Create directory


Mkdir newdir # Create a newdir directory in the current directory


Display the complete path of the current directory


Pwd # display the complete path of the current directory


Rename www.111cn.net


Rename my-shell.sh new-shell.sh # rename my-shell.sh files to new-shell.sh


Delete an object


Rm new-shell.sh # delete new-shell.sh files


Delete empty directory


Rmdir pro # delete empty directory pro


Create link


Ln abc.txt abc. ln creating a link file abc. ln for abc.txt


Local Command: (local commands generally add l before the command to represent local)


Switch Directory


LCD pro # switch the local directory to the pro Directory


List directory content


Lls-l # Display Local files and directories in Detail List


Create directory


Lmkdir newdir # Create a newdir directory in the current local directory


Display the complete path of the current directory


Lpwd # display the complete path of the local current directory


Execute any local command


! Date # run the command using the local shell ,! It can then be a command that can be recognized by any local machine


! # Switch to the local shell to execute other commands. To exit the local shell, run exit to return to the remote environment.


Exit www.111cn.net:


Bye # exit sftp


Exit # Same as above


Quit # Same as above

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.