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 07-17-2006, 07:58 PM   #1
fredanthony
LQ Newbie
 
Registered: Jul 2006
Posts: 9

Rep: Reputation: 0
creating a user with no shell


Hi, I am trying to setup ftp and system users with no shell access. I have already added a shell /etc/ftponly in /etc/shells. /etc/ftponly is a file containing:
Quote:
#!/bin/sh
#
# ftponly shell
#
trap "/bin/echo Sorry; exit 0" 1 2 3 4 5 6 7 10 15
#
Admin=root@your-domain.com
#System=`/usr/ucb/hostname`@`/usr/bin/domainname`
#
/bin/echo
/bin/echo "********************************************************************"
/bin/echo " You are NOT allowed interactive access."
/bin/echo
/bin/echo " User accounts are restricted to ftp and web access."
/bin/echo
/bin/echo " Direct questions concerning this policy to $Admin."
/bin/echo "********************************************************************"
/bin/echo
#
# C'ya
#
exit 0
What I want to do now is creat users with the ftponly shell and home directories in /home/<username>. I tried useradd -s /etc/ftponly -d /home/<username> -m <username>. Which creates the home directory in the correct place but when I do an ls -al I get:

Quote:
drwxr-xr-x 2 schnap users 4096 2006-07-17 20:43 .
drwxr-xr-x 6 root root 4096 2006-07-17 20:35 ..
-rw-r--r-- 1 schnap users 220 2006-07-17 20:35 .bash_logout
-rw-r--r-- 1 schnap users 414 2006-07-17 20:35 .bash_profile
-rw-r--r-- 1 schnap users 2227 2006-07-17 20:35 .bashrc
So I also see these in FTP. How can I create the user and user dir without these files? Thanks.
 
Old 07-17-2006, 08:45 PM   #2
fredanthony
LQ Newbie
 
Registered: Jul 2006
Posts: 9

Original Poster
Rep: Reputation: 0
just bumpin it up
 
Old 07-17-2006, 08:47 PM   #3
ugenn
Member
 
Registered: Apr 2002
Posts: 549

Rep: Reputation: 30
Don't use the -m and -d options. And set -s to /bin/false. See man useradd for details.
 
Old 07-17-2006, 08:49 PM   #4
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
man nologin
 
Old 07-17-2006, 08:55 PM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I'm not certain what you are trying to accomplish. Do these users need their own home directories?

Read through the addusers man-page. There is an option to use a different skeleton directory to supply the skeleton files for new users. You could use the "-k skeldir" option, and have your ftp skeleton directory be empty. Then nothing will be copied to new user's home directories.

Here is a link to a nixCraft article. The use a similar script called nologin, and have it listed in /etc/shells. This is very similar to how you are doing it:
http://www.cyberciti.biz/nixcraft/vi...ing-access.php

Last edited by jschiwal; 07-17-2006 at 08:58 PM.
 
Old 07-17-2006, 08:59 PM   #6
fredanthony
LQ Newbie
 
Registered: Jul 2006
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by ugenn
Don't use the -m and -d options. And set -s to /bin/false. See man useradd for details.
If I don't use the -m it won't create the users home dir in /home/<username>. I need this for ftp..

I need it so that the user I add has a home dir in /home/<username> and they must not have shell access only ftp and web.
 
Old 07-18-2006, 08:10 AM   #7
fredanthony
LQ Newbie
 
Registered: Jul 2006
Posts: 9

Original Poster
Rep: Reputation: 0
anyone? Thanks.
 
Old 07-18-2006, 08:51 AM   #8
fredanthony
LQ Newbie
 
Registered: Jul 2006
Posts: 9

Original Poster
Rep: Reputation: 0
Ok, what I did is:
Quote:
mv /etc/skel /etc/skel_old
then just created the user with:
Quote:
useradd -d /home/<user> -m -s /etc/ftponly
 
Old 07-18-2006, 09:28 AM   #9
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
You can make the shell `/sbin/nologin' which will politely refuse interactive login sessions. So the easiest way to run the ftp daemon would be as SUID ftp.
 
  


Reply


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
Help with creating a shell script windisch Programming 66 10-07-2005 06:26 AM
what is the command to make a user change their password after creating a new user? naweenio Linux - Newbie 7 01-05-2005 07:07 AM
creating a new user using shell only ? ( RH 9 ) CooLMaN Linux - General 4 04-04-2004 11:42 AM
creating a unique id string in shell gumby Programming 4 05-07-2003 05:56 PM
Creating a linux shell with C CragStar Programming 2 10-02-2002 09:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:18 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration