所属客户端联机程序 -Linux客户端
ssh [ -f ] [ -o 参数项目 ] [ -p 非正规端口 ] [ 账号 ] IP [ 指令 ]
-f : 需要配合后面的指令 ,不登入远程主机直接发送一个指令而已
-o 参数项目 : 主要的参数项目有:
ConnectTimeout=秒数 : 联机等待的时间
StrictHiostKeyChecking=[ yes | no | ask ] 默认是ask
-p : 如果你的sshd服务器启动在非正规的饿端口(22) ,需要此项目;
指令 : 不登陆远程主机直接发送只ing过去(与-f 不同)
example:
使用账号登陆到远程主机
ssh user_name@IP_number
只发送指令而不登陆远程主机
ssh -f root@172.16.121.135 shutdown -h now
===========================================
摸你 FTP的文件传输方式: sftp
ssh是使用远程服务器进行工作,如果你只想从远程服务器下载或者上传资料,那就需要使用sftp或scp.这两个指令也都是使用ssh的22
号端口,只是模拟成FTP与复制的动作而已.
sftp user_name@IP_number
进入到sftp后可以通过指令进行相关操作
get [-Ppr]
put [-Ppr] local-path [remote-path]
Upload local-path and store it on the remote machine. If the
remote path name is not specified, it is given the same name it
has on the local machine. local-path may contain glob(3) charac-
ters and may match multiple files. If it does and remote-path is
specified, then remote-path must specify a directory.
If either the -P or -p flag is specified, then full file permis-
sions and access times are copied too.
If the -r flag is specified then directories will be copied
recursively. Note that sftp does not follow symbolic links when
performing recursive transfers.
sftp的功能和指令很多,详情请自己man一下
============================================
异地复制: scp
通常使用sftp是因为可能不知道服务器上有什么文件存在,如果已经能知道服务器上的文件名了,那么可以直接用scp复制过来
scp [ -pr ] [ -l 速率 ] file 账号@IP_nubmber
-p : 保留源文件的权限数据
-r : 复制目录
-l : 可以 限制传输的速度
example:
将本机的/etc/*下面的文件 全复制到 远程主机的/root/user_etc上
scp /etc/* user@172.16.121.135:/root/user_etc/
将远程主机上的/etc复制到本机的 /root/etc下
scp -r root@172.16.121.135:/etc /tmp