User with limited access to one directory

is there a way to create a user and limit him to read,write and execute only in one direcotry.
the directory is already exsist and it belongs to dba group.

i would like to make this user can't even cd to another directory or even if he can he cant do anything in the other directories.

if anyone can help me with this and with the code in doing it, i would be very great full :slight_smile: thanks in advance

this should be the default thing already.... that is.

if you create a home dir john as /home/john, make him as owner and give all permission... he will not be able to do anything with /home/tom or /home/jerry. ( make the permissions appropriately at tom & jerry )

He can manipulate anything under /home/john. are you looking for this -- read about chmod, chown.

if something else -- explain that ?

what if i want to limit his access to only one directory?

what you mean by only one directory ? -- only /home/john and he should not go to /home/john/Music or something else ?

If it is he can do anything with /home/john, and he should not go for /home/tom, then tom should be owner of that dir, and for others/group dont give read & execute permission.

Although I'm unsure about what precisely your requirements are, you might achieve that by using a combination of ACLs and a restricted shell like rksh.

i would like the user just to access /pcard17/trace

not his home directory

root@zfstest # df -h
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c1t0d0s0       20G   9.8G   9.7G    51%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                    16G   1.7M    16G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/platform/sun4u-us3/lib/libc_psr/libc_psr_hwcap1.so.1
                        20G   9.8G   9.7G    51%    /platform/sun4u-us3/lib/libc_psr.so.1
/platform/sun4u-us3/lib/sparcv9/libc_psr/libc_psr_hwcap1.so.1
                        20G   9.8G   9.7G    51%    /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                    16G   792K    16G     1%    /tmp
swap                    16G    48K    16G     1%    /var/run
/dev/dsk/c1t0d0s6       32G    32M    31G     1%    /data
/dev/dsk/c1t1d0s0       20G   9.8G   9.7G    51%    /bkp-root
iaspool                 15G   3.6G    11G    25%    /ias
oraclepool              15G   7.2G   7.5G    50%    /oracle
pcard01pool            9.8G   1.2G   8.6G    12%    /pcard01
pcard02pool             29G   5.5G    24G    19%    /pcard02
pcard03pool             29G   5.0G    24G    18%    /pcard03
pcard04pool             29G   4.0G    25G    14%    /pcard04
pcard05pool             49G    29G    20G    60%    /pcard05
pcard06pool             49G    22G    27G    46%    /pcard06
pcard07pool             49G    25G    24G    51%    /pcard07
pcard08pool             49G    19G    30G    38%    /pcard08
pcard09pool             29G   9.5G    20G    33%    /pcard09
pcard10pool             29G   6.0G    23G    21%    /pcard10
pcard11pool             29G    11G    19G    37%    /pcard11
pcard12pool             29G   6.0G    23G    21%    /pcard12
pcard13pool             29G   2.9G    26G    11%    /pcard13
pcard14pool             29G   2.9G    26G    11%    /pcard14
pcard15pool             29G   6.0G    23G    21%    /pcard15
pcard16pool             29G   1.6G    28G     6%    /pcard16
pcard17pool             49G    14G    35G    28%    /pcard17
pcard18pool             29G   4.1G    25G    14%    /pcard18
pcard19pool             29G    22K    29G     1%    /pcard19
pcard20pool             29G   2.1G    27G     8%    /pcard20
pcardbkppool           492G   106G   387G    22%    /pcardbkp
/vol/dev/dsk/c0t0d0/sol_10_509_sparc
                       2.5G   2.5G     0K   100%    /cdrom/sol_10_509_sparc
root@zfstest # cd /pcard17/trace
root@zfstest # pwd
/pcard17/trace
root@zfstest #cd ..
root@zfstest # ls -l
total 475
drwxrwxrwx   2 ora10g   dba            2 Mar 12  2007 lost+found
drwxr-xr-x   2 root     root           8 Sep  6 13:04 oper
drwxrwxrwx   3 ora10g   dba         2518 Oct 25 14:25 trace
root@zfstest #

A user denied read access to his own home directory would fail to log in to the system.

Example option:

The Restricted Bash Shell

If Bash is started with the name rbash, or the `--restricted' option is supplied at invocation, the shell becomes restricted. A restricted shell is used to set up an environment more controlled than the standard shell. A restricted shell behaves identically to bash with the exception that the following are disallowed:

  1. Changing directories with the cd builtin.
  2. Setting or unsetting the values of the SHELL, PATH, ENV, or BASH_ENV variables.
  3. Specifying command names containing slashes.
  4. Specifying a filename containing a slash as an argument to the . builtin command.
  5. Specifying a filename containing a slash as an argument to the `-p' option to the hash builtin command.
  6. Importing function definitions from the shell environment at startup.
  7. Parsing the value of SHELLOPTS from the shell environment at startup.
  8. Redirecting output using the `>', `>|', `<>', `>&', `&>', and `>>' redirection operators.
  9. Using the exec builtin to replace the shell with another command.
  10. Adding or deleting builtin commands with the `-f' and `-d' options to the enable builtin.
  11. Specifying the `-p' option to the command builtin.
  12. Turning off restricted mode with `set +r' or `set +o restricted'.