ZT 建立只用于FTP的账户[1]

[入库:2005年9月19日] [更新:2007年3月24日]

本文简介:


http://www.itworld.com/nl/unix_sys_adm/07102002/pf_index.html

The FTP-Only Account  
Until recently, I didn't think that, short of writing a new shell, providing a Unix account that permitted a user to ftp files back-and-forth while preventing any other actions was possible. The closest thing was anonymous ftp, where a user could transfer files using a username and password (though the username was "anonymous" and the password almost anything at all), but anonymous ftp doesn't provide a user with his own file space and this might easily be a requirement. 

I was wrong. It is possible to create an FTP-only account and, further, the method by which this can be done is well within the realm of what I should have realized all along was possible. It combines two small pieces of Unix know-how or "tricks". 

The first "trick" to setting up an account of this sort is to assign the user a shell that doesn't exist. That's right. There's no need to create a program or even touch a file. Simply insert the string of your choice into the shell field of the /etc/passwd file. This keeps the user from being able to log in to the system. If he tries to telnet in to the system, for example, he gets a "no shell" error like what is shown below. In fact, almost anything he might try to do, even running a remote shell command, will balk at the invalid shell. In this example, we've named our ftp-only user "ftponly" and set his shell to /bin/noop. Notice how he is denied access because the shell associated with his account doesn't exist. 

------------------------------ cut here -------------------------------- # telnet dragonfly Trying 10.10.10.10... Connected to dragonfly.dragonflyditch.com. Escape character is '^]'. 

SunOS 5.8 

login: ftponly
Password: Last login: Sat Jun 29 23:38:08 from dragonfly.dragon No shell Connection closed by foreign host. ------------------------------ cut here -------------------------------- 

When the ftp-only user tries the ftp command, on the other hand, the system checks that his shell is in the /etc/shells file and checks nothing else. That's right. Since the ftp command does not require anything from the user's environment in order to transfer files in either direction, no further checking is done. Ftp sessions are, in fact, one of the few user connections that do not establish the user's working environment. 

Let's watch the ftp-only user connect to the system with ftp. 

本文关键:ZT 建立只用于FTP的账户
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top