![]() |
[root@www ~]# cd /root/.ssh
[root@www .ssh]# ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
8f:f7:45:87:a0:11:a2:a7:ec:88:45:e8:33:21:35:3f root@www.andowson.com
[root@www .ssh]# ls -la
總計 24
drwx------ 2 root root 4096 11月 10 11:39 .
drwxr-x--- 7 root root 4096 10月 20 14:13 ..
-rw------- 1 root root 668 11月 10 11:39 id_dsa
-rw-r--r-- 1 root root 611 11月 10 11:39 id_dsa.pub
-rw-r--r-- 1 root root 2794 10月 9 22:41 known_hosts
[root@www .ssh]# scp id_dsa.pub 192.168.1.4:/root/.ssh/authorized_keys2
The authenticity of host '192.168.1.4 (192.168.1.4)' can't be established.
RSA key fingerprint is e2:61:f0:78:31:21:72:ce:06:dd:da:02:f1:41:05:ec.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.4' (RSA) to the list of known hosts.
root@192.168.1.4's password:
id_dsa.pub 100% 611 0.6KB/s 00:00
[root@www .ssh]# ssh 192.168.1.4
Last login: Sat Nov 10 11:37:58 2007 from 192.168.1.2
#! /bin/bash
hosts="192.168.1.4"
for siteuser in `cat /root/admin/sites.txt`
do
if [ -d /home/${siteuser} ]
then
for host in $hosts
do
echo "sending $siteuser files to $host ..."
rsync -avlR --delete -e ssh /home/${siteuser}/ ${host}:/
done
fi
done
echo "done"
andowson
30elite
ezmatch
chmod 755 /root/admin/autosync.sh
/root/admin/autosync.sh
*/2 * * * * /root/admin/autosync.sh
檔案名稱 | autosync.sh |
描述 | autosync.sh |
檔案大小 | 312 bytes |
下載次數 | 22 次 |
![]() |
chmod 700 ~/.ssh
chmod 640 ~/.ssh/authorized_keys2