Swappp
Advanced Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору eugrus Цитата: Хочу написать shell-скрипт который бы подключился к серверу по ssh и там бы что-то сделал | man ssh... Цитата: ssh [-1246AaCfgkMNnqsTtVvXxY ] [-b bind_address ] [-c cipher_spec ] -words [-D port ] [-e escape_char ] [-F configfile ] [-i identity_file ] [-L Xo Sm off port host hostport Sm on ] [-l login_name ] [-m mac_spec ] [-o option ] -words [-p port ] [-R Xo Sm off port host hostport Sm on ] [-S ctl ] [user @ hostname ] [command ] | например Код: ssh 127.0.0.1 /home/user/script.sh | заливать скрипт можно sftp man sftp только незнаю как быть с авторизацией... Добавлено: Цитата: ssh implements the RSA authentication protocol automatically. The user creates his/her RSA key pair by running ssh-keygen(1). This stores the private key in $HOME/.ssh/identity and stores the public key in $HOME/.ssh/identity.pub in the user's home directory. The user should then copy the identity.pub to $HOME/.ssh/authorized_keys in his/her home directory on the remote machine (the authorized_keys file corresponds to the conventional $HOME/.rhosts file, and has one key per line, though the lines can be very long). After this, the user can log in without giving the password. RSA authentication is much more secure than rhosts authentication. | тоесть вообще проблем нет. Добавлено: Цитата: swappp@localhost ~ $ ssh 192.168.0.1 "cd /;ls -l" total 68 drwxr-xr-x 2 root root 4096 Jan 23 18:36 bin drwxr-xr-x 2 root root 4096 Jan 26 22:32 boot drwxr-xr-x 1 root root 0 Jan 1 1970 dev drwxr-xr-x 30 root root 4096 Apr 3 07:37 etc drwxr-xr-x 3 root root 4096 Sep 30 2004 home drwxr-xr-x 9 root root 4096 Jan 23 17:42 lib drwx------ 2 root root 16384 Sep 30 2004 lost+found drwxr-xr-x 5 root root 4096 Jan 23 20:30 mnt drwxr-xr-x 2 root root 4096 Jul 18 2004 opt dr-xr-xr-x 27 root root 0 Apr 2 09:37 proc drwx------ 6 root root 4096 Mar 30 21:58 root drwxr-xr-x 2 root root 4096 Mar 29 23:13 sbin drwxr-xr-x 2 root root 4096 Jul 18 2004 sys drwxrwxrwt 5 root root 4096 Apr 3 07:35 tmp drwxr-xr-x 13 root root 4096 Jan 23 05:18 usr drwxr-xr-x 12 root root 4096 Sep 30 2004 var swappp@localhost ~ $ | 192.168.0.1 мой роутер. | Всего записей: 1716 | Зарегистр. 02-11-2001 | Отправлено: 19:10 03-04-2005 | Исправлено: Swappp, 19:29 03-04-2005 |
|