用镜头记录,用心灵体验 | 订阅本站 | 所有笔记 | 亲和力设计 | 流量

DB2 学习笔记

博客话题:DB2,Linux,Web,业余无线电,户外,摄影,截拳道,Thankpad,其他

Linux

Automic login with sftp

目录

  1. 2006-6-14 Update

It's impossible to automic log into server using sftp in unix shell script with password authorization like what we can do with ftp below.

ftp -nv <<EOF
open ${FTP_HOST}
user ${FTP_USER}
${FTP_PASSWD}
binary
cd ${FTP_DIR}
put ${FTP_FILE_NAME}
dir
${FTP_FILE_NAME}
quit
EOF          

But we have another solution for this, once it setup, it both conveneint and sercure. see following steps. tested on AIX.

On the client machine, type:

ssh-keygen -t rsa (or dsa, depending on the desired mode)
respond to the questions with CR

Make sure that the ssh daemon is running on the server.

On the client machine, CD to the .ssh directory in your home directory
and type:

scp id_rsa.pub <serverloginid>@<serverhostname>:id_rsa.pub
you will have to enter the password this time

Log onto the server and CD to your home directory. (The "id_rsa.pub"
file should be visible). Check to see if a .ssh directory exists; if
not, create one and type:

cat id_rsa.pub >> .ssh/authorized_keys

You can delete the id_rsa.pub file from the server (or move it into the
.ssh folder).

That should set up the automatic login authentication.

Reference

2006-6-14 Update

If access to the remote system is still denied you should
check the permissions of the following files on it:
  • the home directory itself
  • the ~/.ssh directory
  • the ~/.ssh/authorized_keys file

The permissions should allow writing only by you (the owner). This example shows the most relaxed permissions you could use.

  hrothgar% cd
hrothgar% ls -ld . .ssh .ssh/authorized_keys
drwxr-xr-x 36 kim kim 4096 Jul 25 02:24 .
drwxr-xr-x 2 kim kim 512 Apr 10 02:30 .ssh
-rw-r--r-- 1 kim kim 1674 Apr 10 02:29 .ssh/authorized_keys

Alex's picture

my email address in picture

搜索|Search

评论|Recent Comments

相似文章|Related Entries

按月归档|By Month

2009
07
2008
11
10
07
05
04
03
02
01
2007
12
10
07
06
05
04
03
02
01
2006
12
11
10
09
08
07
06
05
04
03
02
01
2005
11
10
09
08
07
04
03
2004
12
11
10
09
08
07
06
05
04
03
02
01
2003
12
10
09
08
06
2002
09
08
04
03
02
2001
12
09
07
06
05

我读|My Books

我的链接|My Links

我的朋友|My Friends

Creative Commons License
This blog is licensed under a Creative Commons License.
Movable Type 4 Logo