LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-25-2018, 01:45 PM   #1
StFrosty
LQ Newbie
 
Registered: Jun 2018
Posts: 2

Rep: Reputation: Disabled
Unhappy Problem with a jail user on Ubuntu 14.04


Good afternoon! I am totally new and I do not have much idea about some things. I put you in a situation, I have a VPS with Ubuntu 14.04, recently I had some security problems for certain users that, of course, are already solved. The fact is that since then, I want to have more security, so I opted to cage the invited users so they can only use their / home. So far so good, I used a tutorial (https://gnupatagonia.com.ar/enjaular-usuarios-sftp/) and the truth is, quite simple. The problem is this: I would like Guest Users to also have access to the console (shell) but I want them to only have access to their / home too.
I have Webmin, I looked at the configuration of the users and for example, I changed the type of shell, since with the command that I used it was put in / bin / false. I edited it and set it in / bin / dash and it did not work, I kept testing with / bin / sh and neither, I did not see much hope.

This appear when I open a shell with the Guest User: http://subefotos.com/ver/?dedea4ac18...8e753f591o.png

Thanks in advance!

And sorry for my english
 
Old 06-25-2018, 03:46 PM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,725

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Welcome to LQ

When you modified the user's login shell, did you also supply the ~/.profile and ~/.<shell>rc files? (I don't know what sh uses, it would be ~/.bashrc if the login shell was bash)?
You can also specify the home directory in webmin. It's apparently not set correctly for the user and/or it has the wrong permissions. (Linux will say "No such file or directory" when the file or directory exists, but the user doesn't have permissions to see it)

Does the home directory exist? What are it's permissions?
Code:
ls -l /home/dir/user
PS Your English is good.
 
Old 06-27-2018, 02:05 PM   #3
StFrosty
LQ Newbie
 
Registered: Jun 2018
Posts: 2

Original Poster
Rep: Reputation: Disabled
I use this command to create the user;
sudo useradd -g usuariossftp -s /bin/false -d /home/sftp/usuario1 usuario1
sudo passwd usuario
I give all permission to the directory's user with this:
sudo mkdir /home/sftp/usuario1/archivos
sudo chown usuario1:usuariossftp /home/sftp/usuario1/archivos
And yes, it work perfectly, he only can upload, download or remove files if they are on him directory.

I know that with -s /bin/false he can't use the shell, but if I change it to -s /bin/dash or something like this, he can't open a SFTP channel, and the shell can't use too.

I dont understand what do you mean with: ~/.profile and ~/.<shell>rc files?
 
Old 06-27-2018, 02:16 PM   #4
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,725

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Quote:
Originally Posted by StFrosty View Post
I use this command to create the user;
sudo useradd -g usuariossftp -s /bin/false -d /home/sftp/usuario1 usuario1
sudo passwd usuario
I give all permission to the directory's user with this:
sudo mkdir /home/sftp/usuario1/archivos
sudo chown usuario1:usuariossftp /home/sftp/usuario1/archivos
And yes, it work perfectly, he only can upload, download or remove files if they are on him directory.

I know that with -s /bin/false he can't use the shell, but if I change it to -s /bin/dash or something like this, he can't open a SFTP channel, and the shell can't use too.

I dont understand what do you mean with: ~/.profile and ~/.<shell>rc files?
I'm pretty sure one can't access the shell via sftp. Is that what you're trying to configure?

It looks like you've set the users home directory to /home/sftp/usuario1
But then configured the directory /home/sftp/usuario1/archivos
Who owns /home/sftp/usuario1?
The user's home directory is the same for both ssh and sftp...I think.

Shell home directories usually contain a .profile and/or a .somethingrc file (for bash, it's .bashrc) that set up the environment. Are those present in the home directory?
 
  


Reply



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
user in jail ( vsftpd ) abd_bela Linux - Server 3 03-18-2016 04:28 AM
[SOLVED] chroot jail problem: 'empty' jail MatrixS_Master Linux - Security 4 03-27-2010 06:25 AM
User Creationg : ssh/sftp user jail to $HOME only routers Solaris / OpenSolaris 2 10-29-2007 11:28 PM
jail user to /home/user directory confused_user Linux - Security 12 03-15-2006 09:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:36 AM.

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