Automatically log on to the remote server in linux

Source: Internet
Author: User
Tags ssh server
Article Title: Automatically log on to the remote server in linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Two different methods are summarized as follows:

1. mount to the server. You need to use reverse CT and smbmount. The script is as follows:

#! /Usr/bin/CT

# Auto mountserver

Set timeout-1

Set password "xxxxxxxx"

Spawn-ignore HUP smbmount // 192.168.1.6/AAAAAAAA/home/aaaaaaaaaa/mount-o user = AAAAAAAA

Login CT "Password *"

Send "$ password \ r"

CT "\ n"

Ii. ssh to the server and have logged on to the server. You only need ssh. The operations are as follows:

1. First, let's take a look ~ /. Ssh/whether the file id_dsa.pub exists in this directory. If not, run the following command to generate

# Ssh-keygen-t dsa

2. Copy id_dsa.pub to the personal directory of the ssh server.

# Scp ~ /. Ssh/id_dsa.pub [User Account] @ [host name or IP address]:

3. log on to the ssh server.

# Ssh [User Account] @ [host name or IP address]

4. Convert id_dsa.pub ~ /. Ssh/authorized_keys

# Cd

# Cat id_dsa.pub>. ssh/authorized_keys

Delete useless id_dsa.pub (because it has been transferred to. ssh/authorized_keys)

# Rm id_dsa.pub

Now, the settings are complete. Then, write the following script, named loginserver, and guard loginserver against the PATH. In this way, you can execute loginserver anywhere and log on to the server.

#! /Bin/bash

# Auto mountserver

Ssh [User Account] @ [server]

Try loginserver on the terminal? OMG, you are already on the server

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.