LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   adduser but no shell and no home dir (https://www.linuxquestions.org/questions/linux-newbie-8/adduser-but-no-shell-and-no-home-dir-156687/)

ryedunn 03-12-2004 08:05 AM

adduser but no shell and no home dir
 
I would like to setup a user strictly for FTP, so I do not want them to have access to a shell nor do I want them to have a home dir. I know the GUI in RH9 allowed me to do this but how can I from a CLI (command line) in Mandrake9.2?

And yes, I did RTFM. :)

thanks.
The GNUbie

homey 03-12-2004 08:47 AM

Try this something like this..


useradd -g ftpusers -d /dev/null fred

ryedunn 03-12-2004 09:21 AM

well
 
looks like its still letting me ssh in...

Could not chdir to home directory /dev/null: Not a directory
-bash: /dev/null/.bash_profile: Not a directory
-bash-2.05b$

:( any other suggestions?

ryedunn 03-12-2004 09:42 AM

for the next guy
 
http://www.linuxnetmag.com/en/issue7/m7secureftp1.html

comp12345 03-12-2004 12:40 PM

set the login shell to /bin/false

Komakino 03-12-2004 01:21 PM

I had the same problem...still haven't resolved it. Even WITH all the correct options for useradd it just adds the user, no home directory or anything.

saminur@ymail.com 06-14-2011 10:54 PM

How can i create any user without making directory in home??? any one can suggest me??

SothebyIT 09-05-2011 09:52 AM

Saminur.. I recently used the command

root@testsvr:~# useradd -g testgroup -d /dev/null -s /dev/null testuser2

to create a user "testuser2" in the group "testgroup" with no shell access or home directory. Technically the command assigns /dev/null to be the home dir. It also assigns the shell as /dev/null. There are lots of posts around saying to use /bin/noshell as the shell but I feel happier using /dev/null and its always worked fine for me. (/dev/null is can be thought of as a blackhole in linux, anything sent to it vanishes!)

To allow this account to be used for anything, ftp etc you will need to give the user a password by issuing the command

root@testsvr:~# passwd testuser2

then entering and confirming the password.

Hope this helps, this works on Ubuntu but should work on most if not all distros as far as im aware.


All times are GMT -5. The time now is 11:29 AM.