Linux Tutorial: Create vsftpd FTP accounts Red Hat

Comments 2 Standard

You’ll need to be logged in as a admin user otherwise you’ll need to use su or sudo in front of these commands.

Setting up the account

  1. Modify shell file:
    • vi /etc/shells
  2. Press letter i to go into insert mode
  3. Add /dev/null to the end of the list, it looks something like this now:
    • /bin/bash
    • /bin/sh
    • /bin/ash
    • /bin/bsh
    • /bin/zcsh
    • /dev/null
  4. Hit the escape key to exit insert mode. Save your changes:
    • :wq
  5. Now we’ll create the user’s account. Replace [username] with the name of the account you’re creating. Replace [home_dir] with the home directory you want them to be able to FTP into:
    • useradd -d [home_dir] -s /dev/null [username] > /dev/null 2>&1
  6. Next we’ll change the user’s password. Follow the prompt messages that come up:
    • passwd [username]
  7. Now we have to modify /etc/passwd to give them the correct “fake” shell we created
    • vi /etc/passwd
  8. Hit i to go into insert mode and find the line at the bottom with the username you created. Don’t change the [groupid] numbers that appear in the beginning. Change it to:
    • [username]:x:[groupid]:[groupid]::[home_dir]:/dev/null
  9. Hit escape to exit insert mode and save your changes
    • :wq
  10. Now we need to update the permissions on their [home_dir] folder so that the username with the same group owns the files and folders:
    • chown -R [username]:[username] [home_dir]

Setting up vsftpd

  1. Start by editing the vsftpd.conf file:
    • vi /etc/vsftpd/vsftpd.conf
  2. Press i to go into insert mode.
  3. Uncomment anonymous_enable and set it to no
    • anonymous_enable = NO
  4. Uncomment (or add if it’s not there) userlist enable and set it to yes
    • userlist_enable = YES
  5. Press escape to exit insert mode and save your changes:
    • :wq
  6. Now we’ll add the user we created to the userlist:
    • vi user_list
  7. Press i to go into insert mode
  8. Add [username] to the bottom of the list
  9. Hit escape to exit insert mode and save your changes:
    • :wq
  10. Start the vsftpd service:
    • service vsftpd start
  11. Test your ftp account. Replace [ip address] with the ip address of your machine. Enter the username and password when prompted. Voila, you’ve connected to ftp using that new user!:
    • ftp [ip_address]
    • [username]
    • [password]


530 Cannot Change Directory – double check that the [home_dir] has the proper permissions setup. The file should probably be chmod 0700 or 0755.

500 Permission Denied – Your username isn’t be recognized as being allowed FTP access by SELinux or isn’t on the userlist for sftp. Follow the steps above to add them to the userlist and modify your .conf file. Restart the service:

  • service vsftpd restart

If that still doesn’t work try this so SELinux will allow the FTP to change the users home directory:

  • setsebool -P ftp_home_dir=1

References: x | x | x

Useful Intel Articles

Leave a comment Standard
  1. Designing artificial intelligence for video games.
  2. Fluid Simulation for video games.
  3. Tips & Tricks.
  4. An approach to optimizing a game engine.
  5. Neural networks in video games.
  6. Character animation: skeleton animations and inverse kinetics.
  7. Code demo: destroy the castle.
  8. Havok physics engine demo.

Linux Tutorial: Installing or Upgrading an RPM on Red Hat

Leave a comment Standard

SinceĀ  I look these up all the time I figured it was time to put them all in one place!

Installing an RPM

rpm -ivh package_name_here.rpm

Updating an RPM

rpm -uvh package_name_here.rpm

Check To See if the RPM is Installed

rpm -qa package_name_here.rpm

Check To See if the RPM is Installed (partial name)

rpm -qa | grep part_name

Getting More Help on RPMS and Options

rpm –help