当前位置: 技术问答>linux和unix
HP-UX下如何建立FTP服务器啊?好象和Linux不一样啊!哪位大侠给个详细的说明。
来源: 互联网 发布时间:2015-05-21
本文导语: RT | 转 Configuring Anonymous ftp Access Anonymous ftp allows a user without a login on your host to transfer files to and from a public directory. A user types the ftp command to connect to your host and typ...
RT
|
转
Configuring Anonymous ftp Access
Anonymous ftp allows a user without a login on your host to transfer files to and from a public directory. A user types the ftp command to connect to your host and types anonymous or ftp as a login name. The user can type any string of characters as a password. (By convention, the password is the host name of the user's host). The anonymous user is then given access only to user ftp's home directory, usually called /home/ftp.
Configuring anonymous ftp access involves the following tasks, described in this section:
To Add User ftp to /etc/passwd
To Create the Anonymous ftp Directory
You can follow the instructions in this section, or you can use SAM to configure anonymous ftp access. SAM (System Administration Manager) is the Hewlett-Packard windows-based user interface for performing system administration tasks. To run SAM, type sam at the HP-UX prompt. SAM has an extensive online help facility.
To Add User ftp to /etc/passwd
Use a text editor to add a line for user ftp to the /etc/passwd file, as in the following example:
ftp:*:500:guest:anonymous ftp:/home/ftp:/usr/bin/false
The password field should be *, the group membership should be guest, and the login shell should be /usr/bin/false. In this example, user ftp's user ID is 500, and the anonymous ftp directory is /home/ftp.
Type man 4 passwd at the HP-UX prompt for information on the passwd file.
To Create the Anonymous ftp Directory
Create the ftp home directory that you configured in the /etc/passwd file, as in the following example:
cd /home
mkdir ftp
Create the subdirectory /usr/bin under the ftp home directory:
cd /home/ftp
mkdir usr
cd usr
mkdir bin
Copy the ls and pwd commands from /sbin to ~ftp/usr/bin, and set the permissions on the commands to 0111 (executable only):
cp /sbin/ls /home/ftp/usr/bin
cp /sbin/pwd /home/ftp/usr/bin
chmod 0111 /home/ftp/usr/bin/ls
chmod 0111 /home/ftp/usr/bin/pwd
Set the owner of the ~ftp/usr/bin and ~ftp/usr directories to root, and set the permissions to 0555 (not writeable):
chown root /home/ftp/usr/bin
chmod 0555 /home/ftp/usr/bin
chown root /home/ftp/usr
chmod 0555 /home/ftp/usr
Create the subdirectory etc under the ftp home directory:
cd /home/ftp
mkdir etc
Copy /etc/passwd and /etc/group to ~ftp/etc. These files are required by the ls command, to display the owners of files and directories under ~ftp.
cp /etc/passwd /home/ftp/etc
cp /etc/group /home/ftp/etc
Replace the password field in all entries in /home/ftp/etc/passwd with *, and delete the shell field from the end of each entry:
ftp:*:500:guest:anonymous ftp:/home/ftp:
acb:*:8996:20::/home/acb:
Replace the password field in all entries in /home/ftp/etc/group with *:
users:*:20:acb
guest:*:21:ftp
Set the owner of the files in ~ftp/etc to root, and set the permissions to 0444 (read only):
chown root /home/ftp/etc/passwd
chmod 0444 /home/ftp/etc/passwd
chown root /home/ftp/etc/group
chmod 0444 /home/ftp/etc/group
Set the owner of ~ftp/etc to root, and set the permissions to 0555 (not writeable):
chown root /home/ftp/etc
chmod 0555 /home/ftp/etc
Create a directory called pub under ~ftp. Set its owner to user ftp and its permissions to 0777 (writeable by all). Anonymous ftp users can put files in this directory to make them available to other anonymous ftp users.
mkdir /home/ftp/pub
chown ftp /home/ftp/pub
chmod 0777 /home/ftp/pub
Create a directory called dist under ~ftp. Set its owner to user root and its permissions to 0755 (writeable only by root). The superuser can put read-only files in this directory to make them available to anonymous ftp users.
mkdir /home/ftp/dist
chown root /home/ftp/dist
chmod 0755 /home/ftp/dist
Set the owner of user ftp's home directory to root and the permissions to 0555 (not writeable).
chown root /home/ftp
chmod 0555 /home/ftp
An anonymous ftp directory has the structure shown in Directory Structure for Anonymous ftp Account
Configuring Anonymous ftp Access
Anonymous ftp allows a user without a login on your host to transfer files to and from a public directory. A user types the ftp command to connect to your host and types anonymous or ftp as a login name. The user can type any string of characters as a password. (By convention, the password is the host name of the user's host). The anonymous user is then given access only to user ftp's home directory, usually called /home/ftp.
Configuring anonymous ftp access involves the following tasks, described in this section:
To Add User ftp to /etc/passwd
To Create the Anonymous ftp Directory
You can follow the instructions in this section, or you can use SAM to configure anonymous ftp access. SAM (System Administration Manager) is the Hewlett-Packard windows-based user interface for performing system administration tasks. To run SAM, type sam at the HP-UX prompt. SAM has an extensive online help facility.
To Add User ftp to /etc/passwd
Use a text editor to add a line for user ftp to the /etc/passwd file, as in the following example:
ftp:*:500:guest:anonymous ftp:/home/ftp:/usr/bin/false
The password field should be *, the group membership should be guest, and the login shell should be /usr/bin/false. In this example, user ftp's user ID is 500, and the anonymous ftp directory is /home/ftp.
Type man 4 passwd at the HP-UX prompt for information on the passwd file.
To Create the Anonymous ftp Directory
Create the ftp home directory that you configured in the /etc/passwd file, as in the following example:
cd /home
mkdir ftp
Create the subdirectory /usr/bin under the ftp home directory:
cd /home/ftp
mkdir usr
cd usr
mkdir bin
Copy the ls and pwd commands from /sbin to ~ftp/usr/bin, and set the permissions on the commands to 0111 (executable only):
cp /sbin/ls /home/ftp/usr/bin
cp /sbin/pwd /home/ftp/usr/bin
chmod 0111 /home/ftp/usr/bin/ls
chmod 0111 /home/ftp/usr/bin/pwd
Set the owner of the ~ftp/usr/bin and ~ftp/usr directories to root, and set the permissions to 0555 (not writeable):
chown root /home/ftp/usr/bin
chmod 0555 /home/ftp/usr/bin
chown root /home/ftp/usr
chmod 0555 /home/ftp/usr
Create the subdirectory etc under the ftp home directory:
cd /home/ftp
mkdir etc
Copy /etc/passwd and /etc/group to ~ftp/etc. These files are required by the ls command, to display the owners of files and directories under ~ftp.
cp /etc/passwd /home/ftp/etc
cp /etc/group /home/ftp/etc
Replace the password field in all entries in /home/ftp/etc/passwd with *, and delete the shell field from the end of each entry:
ftp:*:500:guest:anonymous ftp:/home/ftp:
acb:*:8996:20::/home/acb:
Replace the password field in all entries in /home/ftp/etc/group with *:
users:*:20:acb
guest:*:21:ftp
Set the owner of the files in ~ftp/etc to root, and set the permissions to 0444 (read only):
chown root /home/ftp/etc/passwd
chmod 0444 /home/ftp/etc/passwd
chown root /home/ftp/etc/group
chmod 0444 /home/ftp/etc/group
Set the owner of ~ftp/etc to root, and set the permissions to 0555 (not writeable):
chown root /home/ftp/etc
chmod 0555 /home/ftp/etc
Create a directory called pub under ~ftp. Set its owner to user ftp and its permissions to 0777 (writeable by all). Anonymous ftp users can put files in this directory to make them available to other anonymous ftp users.
mkdir /home/ftp/pub
chown ftp /home/ftp/pub
chmod 0777 /home/ftp/pub
Create a directory called dist under ~ftp. Set its owner to user root and its permissions to 0755 (writeable only by root). The superuser can put read-only files in this directory to make them available to anonymous ftp users.
mkdir /home/ftp/dist
chown root /home/ftp/dist
chmod 0755 /home/ftp/dist
Set the owner of user ftp's home directory to root and the permissions to 0555 (not writeable).
chown root /home/ftp
chmod 0555 /home/ftp
An anonymous ftp directory has the structure shown in Directory Structure for Anonymous ftp Account
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。