Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

chroot(8) [opendarwin man page]

CHROOT(8)						    BSD System Manager's Manual 						 CHROOT(8)

NAME
chroot -- change root directory SYNOPSIS
chroot [-u -user] [-g -group] [-G -group,group,...] newroot [command] DESCRIPTION
The chroot utility changes its current and root directories to the supplied directory newroot and then exec's command, if supplied, or an interactive copy of the user's login shell. If the -u, -g or -G options are given, the user, group and group list of the process are set to these values after the chroot has taken place. See setgid(2), setgroups(2), setuid(2), getgrnam(3) and getpwnam(3). Note, command or the shell are run as your real-user-id. ENVIRONMENT
The following environment variable is referenced by : SHELL If set, the string specified by SHELL is interpreted as the name of the shell to exec. If the variable SHELL is not set, /bin/sh is used. SEE ALSO
chdir(2), chroot(2), environ(7), jail(8) HISTORY
The chroot utility first appeared in 4.4BSD. SECURITY CONSIDERATIONS
chroot should never be installed setuid root, as it would then be possible to exploit the program to gain root privileges. BSD
January 24, 2002 BSD

Check Out this Related Man Page

CHROOT(8)						    BSD System Manager's Manual 						 CHROOT(8)

NAME
chroot -- change root directory SYNOPSIS
chroot [-u -user] [-g -group] [-G -group,group,...] newroot [command] DESCRIPTION
The chroot command changes its root directory to the supplied directory newroot and exec's command, if supplied, or an interactive copy of your shell. If the -u, -g or -G options are given, the user, group and group list of the process are set to these values after the chroot has taken place. See setgid(2), setgroups(2), setuid(2), getgrnam(3) and getpwnam(3). Note, command or the shell are run as your real-user-id. ENVIRONMENT
The following environment variable is referenced by chroot: SHELL If set, the string specified by SHELL is interpreted as the name of the shell to exec. If the variable SHELL is not set, /bin/sh is used. SEE ALSO
chdir(2), chroot(2), environ(7) HISTORY
The chroot utility first appeared in 4.4BSD. SECURITY CONSIDERATIONS
chroot should never be installed setuid root, as it would then be possible to exploit the program to gain root privileges. 4.3 Berkeley Distribution October 6, 1998 4.3 Berkeley Distribution
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Trace connections

In my organization in order for anyone to go to any Unix server they have to go through "SERVER A" and login as themselves. Then people are free to go enywhere they please. For example: SERVER A, loggs in as himself telnets to SERVER B, loggs in as guest telnets to SERVER C, loggs in as... (8 Replies)
Discussion started by: jraitsev
8 Replies

2. UNIX for Dummies Questions & Answers

echo $SHELL, $PWD and etc.

hi, this echo $SHELL will give the shell name.. how to get the other list of variables (besides SHELL) values? and also, different shells have different variable names (example SHELL) (10 Replies)
Discussion started by: yls177
10 Replies

3. UNIX for Dummies Questions & Answers

Adding root user to a group

Hey everyone, I need a little help.... I need to add my root user to a new group I have created, I'm just alittle unsure how to do this. I know I need to use the 'useradd' command, the user 'root' needs to be added to a new group called 'beoper' and retain his membership in the following... (7 Replies)
Discussion started by: The Specialist
7 Replies

4. Shell Programming and Scripting

Problem about su command ?

In unix prompt when i run following command ... # current user is "aaa" (not root) # I want to run some command with "bbb" user then i using su - bbb -c "command" # Then, my shell request for user "bbb" password before running command If I want to add this command to shell script which... (5 Replies)
Discussion started by: aungomarin
5 Replies

5. Shell Programming and Scripting

Non-interactive user switch to root

Is is possible switch user from a non-root user to root user without entering the password interactively inside a korn shell script which is run by a non-root user? e.g. I have a non-root user called infodba who is in dba group and I want to create a shell script which is executed by infodba... (5 Replies)
Discussion started by: stevefox
5 Replies

6. Shell Programming and Scripting

Make program only run by root

Hi all, i hope i got this in the right place, what i am trying to do is make a program only run by root, ie for instance user fred is logged in and uses firefox, what id like to do is change that so that when fred wants to use firefox he will be asked to enter root password before he is allowed to... (14 Replies)
Discussion started by: dave123
14 Replies

7. Red Hat

restrict access of a user to two directories only

Hi all, I am using RHEL 5.0 I need a user say test to have full access to two directories, say /tmp1 & /tmp2 only other than his home directory. I do not want to change his login shell which is ksh or bash by default. Moreover, he should not even have read access of other directories. ... (10 Replies)
Discussion started by: vikas027
10 Replies

8. Shell Programming and Scripting

How can i copy user permissions(privileges) to a group

Hey there I have a problem and i was hoping that you guys could help me out I want to copy a user privileges to a group and i need to copy all privileges(Recursively) every directory with all its sub directories and I tried some solution and it did not work. I used the following command:- ... (14 Replies)
Discussion started by: The Dark Knight
14 Replies

9. AIX

create user like root

hello I would like to create another user like root With smit user, I have duplicate all the configuration from root to root2 (groupe, secondary group, administrative, etc...) But when I connect with root2, i don't go to all directory: "permission denied !" I don't understand where is the... (10 Replies)
Discussion started by: pascalbout
10 Replies

10. HP-UX

Disable Setuid in HP-UX

Hi All, How to prevent root user from doing setuid(). In otherwords, if the root(any user) is trying to do setuid in a program it should fail. (5 Replies)
Discussion started by: guru13
5 Replies

11. Shell Programming and Scripting

Help need to improve performance :Parallel processing ideas

Hi, Please tell me how to include parallel processing for the below code. Thanks in advance I have a list of users directories in root directory. Each user has a directory by his /her username. I am finding the size of each directorry using du -g command.. and checking if the size exceeds 3GB a... (6 Replies)
Discussion started by: justchill
6 Replies

12. UNIX for Advanced & Expert Users

Chroot jail environment puzzle

I have a simple sandbox program which runs a command as user "nobody" in a chroot jail. It sets resource limits with setrlimit, changes the user id with setuid, changes the root dir with chroot, and then calls exec to execute the command given as command line parameters. It is of course a... (8 Replies)
Discussion started by: john.english
8 Replies

13. Homework & Coursework Questions

Refactoring via SHELL utilities

I am completely new to Shell scripting and I have almost no idea what I'm doing here. I'm not a stranger at all to programming, but the way SHELL is done drives me to insanity. Here's my current issue: 1. We are to create a BASH script called rafactor.sh This program takes in two (or three)... (6 Replies)
Discussion started by: Okysho
6 Replies

14. Shell Programming and Scripting

need a one liner to grep a group info from /etc/group and use that result to search passwd file

/etc/group tiadm::345:mk789,po312,jo343,ju454,ko453,yx879,iy345,hn453 bin::2:root,daemon sys::3:root,bin,adm adm::4:root,daemon uucp::5:root /etc/passwd mk789:x:234:1::/export/home/dummy:/bin/sh po312:x:234:1::/export/home/dummy:/bin/sh ju454:x:234:1::/export/home/dummy:/bin/sh... (6 Replies)
Discussion started by: chidori
6 Replies

15. UNIX for Dummies Questions & Answers

Creating a file where the owner and group is not root

Hi, I'm the root user on my computer, but I'm writing a script that does a lot of file handling. Every time I create a file or directory it automatically requires root privileges. Is there a way I can just create a file that the user can access without a password? For example in my script I... (20 Replies)
Discussion started by: jdilts
20 Replies