Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have problem in creating a new account in linux.

  1. It should not have any /home/.
  2. It only can access a folder and that folder is home default for this account.

Details about my usage: We have a simple folder which contains demo code and we want to create a user to read this folder only :)

How can I do this, thanks first :)

share|improve this question

2 Answers 2

So you just want it to have a home directory outside of /home ?

You can use the -d option of useradd to specify an alternative home location.

As for "it can only access its home folder" you need to be more specific than that. Programs may have trouble running if they don't have access to /tmp, /proc, or /dev.

EDIT: if you don't want your user to execute programs, just have read access to some files, you might be better off sharing your data over https (possibly with webdav if you need read-write). This way you don't need to create a unix user.

You could go with FTP but it is not secure unless obscure security extensions are used. At the very least you can configure SSH so that the user is only allowed to run the sftp server. All these options are quite less troublesome than setting up a chroot jail.

share|improve this answer
    
Thanks for your fast answer, I've just updated my usage –  nXqd Aug 1 '11 at 16:55
    
I agree with B0fh's edit (mostly) If the goal is only to access a few files, go with ftps (ssl/tls). The only reason to use ssh ftp is because the user would already have a user account. Use a ftp daemon with ssl/tls and usernames/passwords that are seperate from the actual system. –  user606723 Aug 1 '11 at 18:12

In complement to B0fh's answer..
It sounds like what you want to do might be a chroot jail.

http://www.antionline.com/showthread.php?t=156511
http://www.howtoforge.com/chroot_ssh_sftp_debian_etch

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.