LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-29-2005, 03:34 AM   #1
guest
Member
 
Registered: May 2003
Distribution: CentOS 5 64 bit
Posts: 255

Rep: Reputation: 30
how to add users in VSFTPD w/ RHEL 4 AS?


I'm pulling my hair out on this one... i can't seem to find any documentation that tells me how to add a user to this VSFTPD program.. Linux is so difficult to use..... they have to make it a lot easier to use!!!!!!! arghhhh
 
Old 03-29-2005, 06:40 AM   #2
geek_to_core
LQ Newbie
 
Registered: Mar 2005
Location: INDIA
Distribution: Fedora Core 3
Posts: 11

Rep: Reputation: 0
this is from vsftpd.conf (default) file.
Quote:
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
#local_enable=YES
local users suffice as ftp users too. So make a new user on your machine and for security reasons make her shell as /bin/nologin.
 
Old 03-30-2005, 11:18 PM   #3
selfxplanatory
LQ Newbie
 
Registered: Mar 2005
Posts: 7

Rep: Reputation: 0
useradd newusername
 
Old 01-10-2009, 03:24 PM   #4
r0man
LQ Newbie
 
Registered: Jan 2009
Distribution: Fedora
Posts: 5

Rep: Reputation: 0
vsftp users

the matter of the ftp users is that the system users are valid in the ftp(vsftp) service.

for example if you have a "test" user in the system, you can do this:
ftp <ip>
and you put the username name of the system:"test"
and the password for that user...

if you want some security what you could do is make chroot in /etc/vsftpd.conf file and limit the users to a gage.

chroot_local_user=yes #To enable the chroot users (gage)
chroot_list_enable=yes #To enable the chroot
chroot_list_file=/etc/vsftpd/vsftpd.chroot_list #add the users to this file.
 
Old 04-17-2009, 08:15 AM   #5
phgrey
LQ Newbie
 
Registered: Apr 2009
Posts: 1

Rep: Reputation: 0
please, one more question. I need to create a new user for VSFTPD that uses PAM on freeBSD. can I too just create a system user? Or not?
thanks a lot.

that's what I see in /etc/pam.d/vsftpd:
auth required /usr/local/lib/pam_pwdfile.so pwdfile /usr/local/etc/vsftpd/vsftpd_logins
account required /usr/lib/pam_permit.so

Last edited by phgrey; 04-17-2009 at 08:29 AM. Reason: file contents
 
Old 03-31-2010, 12:51 PM   #6
mmasseo
LQ Newbie
 
Registered: Mar 2010
Posts: 3

Rep: Reputation: 0
Add vsftp user script

Hi there,
I know this is an old post, but I too was looking to ease the steps in adding vsftp users.
I managed to put together a script using dialogs on centos(based on stuff i found online), to create a simple wizard. Before I lose it, here it is...

This makes it simple for anyone to add a user from the commandline.

here is how you can do it:
1. open a terminal window (command prompt)

2. Create a script called vsftp_add.sh:
"sudo vi /usr/bin/vsftp_add.sh" (or graphically `sudo gedit /usr/bin/vsftp_add.sh`)

3. enter in the following code, and save the file:

Code:


Code:
### VSFTP user add script
#!/bin/bash
# m masseo Jan 7, 2010
# 
# This script uses dialog, as a wizardlike interface to add users to an existing vsftp setup.
 
 
 
 
# Make sure only root can run our script
if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root, or use sudo" 1>&2
   exit 1
fi
 
 
tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
trap "rm -f $tempfile" 0 1 2 5 15
 
 
USERSFILE="/etc/vsftpd/vsftpd_users.txt"
 
#FUNCTIONS
function check_name() {
	grep $USERNAME $USERSFILE
	if [ "$?" = "0" ];
	then
		NAMEOK="no"
		#username exits
        	dialog --title "ERROR" --msgbox "You have chosen a username that exists already, please try again" 10 50
	else
		NAMEOK="yes"
	fi
}
 
 
# Display message with option to cancel
dialog --title "VSFTP user setup" --msgbox "We will now add a new user to this FTP server\" Press  <Enter>  to start or  <Esc> to cancel." 10 50
# Return status of non-zero indicates cancel
if [ "$?" != "0" ]
then
  dialog --title "VSFTP" --msgbox "You canceled your user add. Now exiting..." 10 50
else
  dialog --title "VSFTP" --infobox "user add in \ process..." 10 50
cd /etc/vsftp
 
 
### Prompt user to enter a name
NAMEOK="no"
while [ $NAMEOK != "yes" ]; 
do
	dialog --title "Name" --inputbox "Enter the user you wish to add:" 8 40 2>$tempfile
	retval=$?
case $retval in
  0)
    USERNAME=`cat $tempfile`
    check_name
  ;;
  1)
    echo "Cancel pressed."
    exit 0 ;;
  255)
    if test -s $tempfile ; then
      cat $tempfile
    else
      exit 0
      echo "ESC pressed." 
    fi
    ;;
esac
    VSFTPUSER=$USERNAME
done
 
###Prompt to enter password
dialog --title "Name" --inputbox "Please enter a password for $VSFPTUSER:" 8 40 2>$tempfile
retval=$?
case $retval in
  0)
    PASSWORD=`cat $tempfile`
    VSFTPPASS=$PASSWORD
  ;;
  1)
    echo "Cancel pressed."
    exit 0 ;;
  255)
    if test -s $tempfile ; then
      cat $tempfile
    else
      exit 0
      echo "ESC pressed."
 
    fi
    ;;
esac
 
dialog --title "Credentials" --msgbox "Here is what I am using: \n Username: $VSFTPUSER \n Password: $VSFTPPASS" 10 50
 
##backup the existing config
DATE=`date '+%Y.%m.%d-%H:%M'`
#backup user file
cp /etc/vsftpd/vsftpd_users.txt /etc/vsftpd/vsftpd_users.txt.$DATE
#backup db file
cp /etc/vsftpd/vsftpd_users.db /etc/vsftpd/vsftpd_users.db.$DATE
 
##Append new user and password to the users file
 
echo "$VSFTPUSER" >> $USERSFILE
echo "$VSFTPPASS" >> $USERSFILE
 
#Creating the ftp users database
echo "Creating the FTP user database"
db42_load -T -t hash -f /etc/vsftpd/vsftpd_users.txt /etc/vsftpd/vsftpd_users.db
sleep 2
#make directory for the user
echo "Creating directory for $VSFTPUSER"
mkdir /ftp/$VSFTPUSER
if [ "$?" = "0" ]
then
	echo "Directory created successfully"
	sleep 2
else
	echo "ERROR: Could not create directory, exiting"
	exit 1
fi
 
#Change ownership
echo "Changing ownership of directory for the vsftp user"
chown  -R virtualftp:virtualftp /ftp/$VSFTPUSER
if [ "$?" = "0" ]
then
        echo "Ownership  created successfully"
        sleep 1
else
        echo "ERROR: Could not change ownership, exiting"
        exit 1
fi
if [ "$?" = "0" ]
    then
    dialog --title "Add user" --msgbox "User added successfully." 10 50
    # Mark script with current date and time
    touch ~/.backup
  else
    # Backup failed, display error log
    dialog --title "Backup" --msgbox "User add failed-- Press
<Enter>
    to see error log." 10 50
   dialog --title "Error Log" --textbox /tmp/ERRORS$$ 22 72
  fi
fi
rm -f /tmp/ERRORS$$
clear

4. make it executable (from the command line):
sudo chmod +x /usr/bin/vsftp_add.sh

5. run it:
sudo /usr/bin/vsftp_add.sh

6. Follow the steps onscreen.


(* You need to have the program called dialog installed on the system)

Last edited by mmasseo; 04-05-2010 at 09:36 AM. Reason: Added more steps
 
Old 04-03-2010, 01:06 PM   #7
khodamn
LQ Newbie
 
Registered: Apr 2010
Posts: 1

Rep: Reputation: 0
Quote:
Originally Posted by mmasseo View Post
Hi there,
I know this is an old post, but I too was looking to ease the steps in adding vsftp users.
I managed to put together a script using dialogs on centos(based on stuff i found online), to create a simple wizard. Before I lose it, here it is...

This makes it simple for anyone to add a user from the commandline.

here is how you can do it:
mmasseo tanks for the efforts. I have a problem, when i try to run this command: /usr/bin/vsftp_add.sh i get these error's:

/usr/bin/vsftp_add.sh: line 38: dialog: command not found
/usr/bin/vsftp_add.sh: line 42: dialog: command not found

Do you know how can i fix this?
 
Old 04-05-2010, 09:34 AM   #8
mmasseo
LQ Newbie
 
Registered: Mar 2010
Posts: 3

Rep: Reputation: 0
Hi there,

For this script to work, You need to make certain the program called "dialog" is installed.
in Redhat and Centos you can do this to install it:

1. open up a terminal
2. as root, type: 'yum install dialog' , you should be asked is you would like to install dialog. Just press 'Y' to continue.



mike
 
Old 04-06-2010, 05:51 AM   #9
nonamenobody
Member
 
Registered: Oct 2002
Posts: 138

Rep: Reputation: 22
u
Quote:
Originally Posted by mmasseo View Post
Hi there,
I know this is an old post, but I too was looking to ease the steps in adding vsftp users.
Just to clarify mmasseo, is this a script to add a virtual user? Does RHEL/CentOS use virtual users by default for vsftpd? I am amazed that more distros don't.
 
Old 04-07-2010, 11:37 AM   #10
hyperdaz
Member
 
Registered: Sep 2004
Location: UK
Distribution: CentOS 5.5
Posts: 44

Rep: Reputation: 1
script fails on centos 5.4

here is the output from (pretty default centos 5.4 install)

cp: cannot stat `/etc/vsftpd/vsftpd_users.txt': No such file or directory
cp: cannot stat `/etc/vsftpd/vsftpd_users.db': No such file or directory
Creating the FTP user database
./vftp_add.sh: line 112: db42_load: command not found
Creating directory for dllguest
mkdir: cannot create directory `/ftp/dllguest': No such file or directory
ERROR: Could not create directory, exiting

Cheers
 
Old 04-12-2010, 01:24 PM   #11
mmasseo
LQ Newbie
 
Registered: Mar 2010
Posts: 3

Rep: Reputation: 0
Hello,

Sorry, I realize now that the script I have would only work on the enviroment where I work (Someone configured VSFTP in a non-standard fashion) which is why I wrote the script as i did. I will try to create a better script that works with a more standard vsftp setup.

Sorry for any inconvenience.

Thank you
 
  


Reply

Tags
freebsd, pam, vsftpd


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
vsftpd, web uploads, vsftpd virtual users, apache virtual hosts, home directories jerryasher Linux - Software 7 02-18-2007 06:29 AM
vsftpd and users question future assassin Slackware 2 07-05-2005 04:35 AM
home users with vsftpd swobodin Linux - Software 1 02-15-2004 08:35 AM
creating users with vsftpd myk3 Linux - Newbie 1 11-19-2003 07:54 AM
vsFTPd users question ghight Linux - Software 1 11-06-2003 11:23 AM


All times are GMT -5. The time now is 08:34 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration