The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM
Home Forums Register Rules & FAQ Members List Arcade Search Today's Posts Mark Forums Read


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 !!


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

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-18-2007
Registered User
 

Join Date: Apr 2007
Posts: 8
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
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
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 04-18-2007
grial's Avatar
El UNIX es como un toro
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
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.
Reply With Quote
  #3 (permalink)  
Old 04-18-2007
Registered User
 

Join Date: Apr 2007
Posts: 8
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
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
Reply With Quote
  #4 (permalink)  
Old 04-18-2007
pressy's Avatar
solaris cultist
 

Join Date: Aug 2003
Location: Vienna / Austria (Europe) [EARTH]
Posts: 705
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
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
Reply With Quote
Google UNIX.COM
Reply



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB 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 -7. The time now is 05:52 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger

Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102