Tuesday, June 8, 2010

Create an FTP only account in Solaris

The FTP-only username is ftpuser in the following instructions.
   
1. su to root

2. # cat /etc/passwd|cut -f 1 -d: > /etc/ftpusers

3. # echo 'echo "FTP user"' > /bin/ftpuser
# chmod a+x /bin/ftpuser

4. If /etc/shell exists, add 


/bin/ftpuser 

to the last line. 

If not

# ls /bin/*sh > /etc/shells
 

Then add /bin/ftpuser to the last line

5. # useradd -c "FTP User" -d /export/home/ftpuser -m -s /bin/ftpuser -g staff ftpuser
6. # passwd ftpuser



Source: http://www.tek-tips.com/faqs.cfm?fid=2315 + my modifications.
  
Added on 6/9/2010: I just found that my full access account couldn't ftp any more after this. Only ftpuser can ftp. For some strange reason, my username got added to /etc/ftpusers which lists the users that can NOT ftp... Very very weird. After removing my username, the ftp works again.

No comments: