当前位置:网站首页>SSH implementation of remote login server
SSH implementation of remote login server
2022-04-21 16:45:00 【zqwlearning】
come from :Linux Basic courses
4. ssh
List of articles
4.1 ssh Sign in
Basic usage
Remote login server :
ssh user@hostname
- user: user name
- hostname: IP Address or domain name
You will be prompted when you log in for the first time :
The authenticity of host '123.57.47.211 (123.57.47.211)' can't be established.
ECDSA key fingerprint is SHA256:iy237yysfCe013/l+kpDGfEG9xxHxm0dnxnAbJTPpG8.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
Input yes, Then you can return .
This will record the information of the server in ~/.ssh/known_hosts In file .
Then enter the password to log in to the remote server .
The default login port number is 22. If you want to log in to a specific port :
ssh user@hostname -p 22
The configuration file
create a file ~/.ssh/config.
Then enter in the file :
Host myserver1
HostName IP Address or domain name
User user name
Host myserver2
HostName IP Address or domain name
User user name
When using the server later , Alias can be used directly myserver1、myserver2.
Key login
Create key :
ssh-keygen
Then just go straight back .
After execution ,~/.ssh/ There will be two more files in the directory :
- id_rsa: Private key
- id_rsa.pub: Public key
Which server do you want to log in without password , Just pass the public key to which server .
for example , Want to log in without secret myserver The server . The contents of the public key , Copied to the myserver Medium ~/.ssh/authorized_keys Just in the file .
You can also use the following command to add a public key with one click :
ssh-copy-id myserver
Carry out orders
Command format :
ssh user@hostname command
for example :
ssh user@hostname ls -a
perhaps
# In single quotes $i Can be evaluated
ssh myserver 'for ((i = 0; i < 10; i ++ )) do echo $i; done'
perhaps
# In double quotation marks $i You can't evaluate
ssh myserver "for ((i = 0; i < 10; i ++ )) do echo $i; done"
4.2 scp Transfer files
Basic usage
Command format :
scp source destination
take source Copy the files under the path to destination in
Copy multiple files at once :
scp source1 source2 destination
Copy folder :
scp -r ~/tmp myserver:/home/acs/
Put... In the local home directory tmp Copy folder to myserver In the server /home/acs/ Under the table of contents .
scp -r ~/tmp myserver:homework/
Put... In the local home directory tmp Copy folder to myserver In the server ~/homework/ Under the table of contents .
scp -r myserver:homework .
take myserver In the server ~/homework/ Copy the folder to the current local path .
Specify the port number of the server :
scp -P 22 source1 source2 destination
Be careful : scp Of -r -P And other parameters shall be added as far as possible source and destination Before .
Use scp Configure other servers vim and tmux
scp ~/.vimrc ~/.tmux.conf myserver:
版权声明
本文为[zqwlearning]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204211639368235.html
边栏推荐
猜你喜欢

Yunna: basic functional features of fixed asset management system in asset intensive enterprises
![[interview ordinary people vs Expert Series] can you talk about CAS mechanism?](/img/f3/4be96982e9199f676b685ccf39ec5a.png)
[interview ordinary people vs Expert Series] can you talk about CAS mechanism?

C sliding verification code | puzzle verification | slidecaptcha

Use of Arthas tunnel

机器学习吴恩达课程总结(一)

2-4. 端口绑定

2018-8-10-use-resharper-features

2022 bone conduction earphone ranking, the best bone conduction earphone recommended

Yunna: computer room asset management system web version, application of equipment asset information management
掌握自动化测试必要的几种技能?
随机推荐
携程网主站XSS漏洞
Multi core and multi CPU programming -- task scheduling
JS milliseconds to days, minutes and seconds
Microsoft IE local file detection vulnerability
服装行业要渡“疫情劫”,赢家时尚凭什么成为增长样本?
OJ daily practice - maximum common divisor and minimum common multiple
flutter dart .. Addall
微软IE本地文件读取漏洞
SIGIR 2022 | 从Prompt的角度考量强化学习推荐系统
Cookie&Session学习
Iterative deepening search
直播带货、送外卖、做货运,航空公司靠副业“回血”
Sohu white society cross site vulnerability
【观察】紫光云:同构混合云升级为分布式云,让云和智能无处不在
IvorySQL亮相于PostgresConf SV 2022 硅谷Postgres大会
怡宝IPO,农夫山泉慌了?
Start redis process
iOS开发面试攻略(KVO、KVC、多线程、锁、runloop、计时器)
易鲸捷数据库将获得中国软件投资,不超过3.89亿元
4.25 unlock openharmony technology day! The annual event is about to open!