Search My Techie Guy

Tuesday, July 1, 2014

How to create a linux user and enable ftp

Here, you will create a linux user account on the command line, and grant that user ftp access:
(Am using SUSE Linux, Enterprise).

1. Create the User Account:

# useradd -d /home/peter -m peter
# passwd peter
#
#

2. Test if ftp service is working (connection refused means that ftp is NOT running):

# ftp localhost
Trying 127.0.0.1...
ftp: connect to address 127.0.0.1: Connection refused
Trying ::1...
ftp: connect: Connection refused

3. Start FTP Server:

/etc/init.d/vsftpd start
Starting vsftpd                                                       done


4. Test Again (Now it's connected):

# ftp localhost
Trying 127.0.0.1...
Connected to localhost.
220 (vsFTPd 2.0.4)
Name (localhost:root): 

5. Try to Login with the user we created (fails):

Name (localhost:root): peter
530 This FTP server is anonymous only.
ftp: Login failed.
ftp>

6. This means that local users are NOT allowed to access the ftp service.

7. So we edit the vsftpd.conf file and remove the hash from this line:

# vi /etc/vsftpd.conf

8. Before:

# Local FTP user Settings

# Uncomment this to allow local users to log in.
#
#local_enable=YES

9. After:

# Local FTP user Settings

# Uncomment this to allow local users to log in.
#
local_enable=YES

10. Restart the vsftpd service

# /etc/init.d/vsftpd restart
Shutting down vsftpd                                                  done
Starting vsftpd                                                       done


11. Try to login Again:

# ftp localhost
Trying 127.0.0.1...
Connected to localhost.
220 (vsFTPd 2.0.4)
Name (localhost:root): peter
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> 
ftp> 

12. Problem Solved :-)


No comments: