ZKX's LAB

linux脚本执行远程服务器命令 linux shell脚本执行mysql mysql数据库在远程服务器上

2021-04-28知识2

我想远程登录 linux 服务器,执行一条sybase 数据库的命令,具体应该怎么做? isql-Uusername-Ppassword进入后选择数据库:use databasego执行sql语句,例如:select*from tablenamego如果有SQL文件,可以直接执行 isql-Uusername-Ppassword-ifilename.sql

shell写个linux脚本,功能是telnet某台服务器,运行一个命令并把命令结果存到本地。 其实这种交互式的操作首选expect脚本。Shell的话可以试试下面这样:bin/kshtelnet 16.158.49.140。rootomslsOUTPUT

linux中ssh如何远程执行一条命令,而且不登录远程服务器? 一 SSH命令使用技巧-远程登录ssh user@remote.machine远程执行ssh user@remote.machine 'command.'远程复制scp user@remote.machine:/remote/path/local/pathscp/local/path user@remote.machine:/remote/pathX forwardssh-X user@remote.machinexcommand.Tunnel/Portforwardssh-L 1234:remote.machine:4321 user@remote.machinessh-R 1234:local.machine:4321 user@remote.machinessh-L 1234:other.machine:4321 user@remote.machine二,实作1)禁止 root 登录#vi/etc/ssh/sshd_configPermitRootLogin no2)废除密码登录,强迫使用 RSA 验证(假设 ssh 账户为 user1)#vi/etc/ssh/sshd_configRSAAuthentication yesPubkeyAuthentication yesAuthorizedKeysFile.ssh/authorized_keysPasswordAuthentication noservice sshd restartsu-user1mkdir~/.ssh 2>;/dev/nullchmod 700~/.sshtouch~/.ssh/authorized_keyschmod 644~/.ssh/authorized_keys登入 端:ssh-keygen-t rsa(按三下 enter 完成﹔不需设密码,除非您会用 ssh-agent。scp~/.ssh/id_rsa.pub user1@server.machine:id_rsa.pub(若是 windows client,可用 puttygen.exe 产生 public key,。

随机阅读

qrcode
访问手机版