The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Can't create users in /home sdspawankumar SUN Solaris 4 08-21-2008 11:13 AM
Home dir for users qfwfq HP-UX 2 01-12-2007 02:18 PM
Profiles for users without home directory naina UNIX for Dummies Questions & Answers 3 02-05-2006 04:41 AM
Monitor which users enter my home directory mnpradeep High Level Programming 1 03-21-2002 05:08 AM
Restrict users to ther home directory alfabetman UNIX for Dummies Questions & Answers 1 10-04-2001 02:31 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-18-2007
mz043 mz043 is offline
Registered User
  
 

Join Date: Apr 2007
Posts: 8
Home Directory Jail for Users

Hi,

I am looking for a shell script (or any other way), that puts a user in a home directory jail. So for example, I have a user named richard and I don't want him wandering outside /usr/users/richard. I don't want him to cd to anywhere including cd ..

Somebody said you can do that with chroot, but I looked it up on the man pages and it says it is used to change the root directory.

Any help will be greatly appreciated.

Thanks
.Michael
  #2 (permalink)  
Old 04-18-2007
grial's Avatar
grial grial is offline Forum Advisor  
El UNIX es como un toro
  
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
Hi, mz043.
As far as I know, you have two options:

- One is to create a chroot jail for your users (As you've been told). This involves several tasks: create a dummy "root filesystem", copy libs, binaries, etc... The use of sudo, and some shell scripting among others. There are lots of info on the Net, depending on your OS.

- The other is the use of a restricted shell. I don't know what OS you are using but perhaps a "man -k restricted" would give you some clues

Regards.
  #3 (permalink)  
Old 04-18-2007
mz043 mz043 is offline
Registered User
  
 

Join Date: Apr 2007
Posts: 8
Thanks for the reply.

I want to avoid chroot, as I don't have much experience with UNIX sysadmin and chroot sounds like the kinda thing that if you get wrong, you quietly pack up your stuff, take a cab to the airport and board the first avail flight

I use tru64 unix --- to be honest I think I'll use Access Control Lists. With them I can restrict access to areas I want. I can do that on the group level as well, so no need to do it for each user individually.

Thanks anyway.
M
  #4 (permalink)  
Old 04-18-2007
pressy's Avatar
pressy pressy is offline Forum Staff  
solaris cultist
  
 

Join Date: Aug 2003
Location: Vienna / Austria (Europe) [EARTH]
Posts: 726
what's about rksh?

Code:
$ rksh
$ cd ..
rksh: cd: restricted
$ cd /
rksh: cd: restricted
$ /usr/sbin/ifconfig
rksh: /usr/sbin/ifconfig: restricted
$
from the man page:

rksh is used to set up login names and execution environ-
ments whose capabilities are more controlled than those of
the standard shell. The actions of rksh are identical to
those of ksh, except that the following are disallowed:

o changing directory (see cd(1))

o setting the value of SHELL, ENV, or PATH

o specifying path or command names containing /

o redirecting output (>, >|, <>, and >>)

o changing group (see newgrp(1)).

The restrictions above are enforced after .profile and the
ENV files are interpreted.

When a command to be executed is found to be a shell pro-
cedure, rksh invokes ksh to execute it. Thus, it is possi-
ble to provide to the end-user shell procedures that have
access to the full power of the standard shell, while impos-
ing a limited menu of commands; this scheme assumes that the
end-user does not have write and execute permissions in the
same directory.
The net effect of these rules is that the writer of the
.profile has complete control over user actions, by perform-
ing guaranteed setup actions and leaving the user in an
appropriate directory (probably not the login directory).

The system administrator often sets up a directory of com-
mands (that is, /usr/rbin) that can be safely invoked by
rksh.

still it's not perfect, but a good way to start...

regards pressy
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:50 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0