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