LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-16-2009, 09:54 AM   #1
tuananh87vn
LQ Newbie
 
Registered: Mar 2009
Posts: 19

Rep: Reputation: 0
using chroot


excuse me,
I don't know how to use chroot to change root of a file. For example, I see that when I run ls -la in /etc, it shows something like resolve.conf -> /etc/resolveconf/run/resolve.conf

so the orginal file is /etc/resolveconf/run/resolve.conf, right? how can I do like that?

can anybody show me how to do :-??

thanks!
 
Old 03-16-2009, 10:32 AM   #2
openSauce
Member
 
Registered: Oct 2007
Distribution: Fedora, openSUSE
Posts: 252

Rep: Reputation: 39
I don't fully understand what you're asking. Are you asking how to create a symbolic link? If so, use ln -s:

Code:
~$ touch file
~$ ln -s file file-link
~$ ls -l file*
-rw-rw-r-- 1 openSauce openSauce 0 2009-03-16 15:30 file
lrwxrwxrwx 1 openSauce openSauce 4 2009-03-16 15:30 file-link -> file
~$
 
Old 03-16-2009, 10:37 AM   #3
tuananh87vn
LQ Newbie
 
Registered: Mar 2009
Posts: 19

Original Poster
Rep: Reputation: 0
oh really, so does chroot have anything to do with it?
 
Old 03-16-2009, 10:46 AM   #4
openSauce
Member
 
Registered: Oct 2007
Distribution: Fedora, openSUSE
Posts: 252

Rep: Reputation: 39
No - chroot changes the root directory used for a command.

So e.g. if you have 2 linux distros installed, and the root filesystem of the inactive one is mounted at /mnt/distro2, you can execute
Code:
chroot /mnt/distro2
and your shell will take / to be /mnt/distro2. Other directories will be inaccessible from this shell, and any commands you enter will execute binaries from the 2nd distro (/bin refers to /mnt/distro2/bin, and so on).
 
Old 03-16-2009, 11:08 AM   #5
tuananh87vn
LQ Newbie
 
Registered: Mar 2009
Posts: 19

Original Poster
Rep: Reputation: 0
so the ln -s makes the file name have the white color (in redhat or fedora), while the original file has white colour. is that true?
 
Old 03-16-2009, 11:19 AM   #6
openSauce
Member
 
Registered: Oct 2007
Distribution: Fedora, openSUSE
Posts: 252

Rep: Reputation: 39
Colour has nothing to do with it. ln -s creates a new file which is simply a pointer to the target file - see here and here.

Are you talking about the colours in the output of ls? These are determined by the environment variable $LS_COLORS, which is usually set in some startup or profile file in /etc. echo $LS_COLORS will tell you whether or not this variable is set.
 
Old 03-16-2009, 11:39 AM   #7
tuananh87vn
LQ Newbie
 
Registered: Mar 2009
Posts: 19

Original Poster
Rep: Reputation: 0
ah yea, got it. thanks alot
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
What does chroot do? Tom Douglas Linux - Security 7 05-04-2008 09:42 AM
chroot to run hd-installed distro's programs from chroot in live distro? silencestone Linux - Software 0 10-12-2007 06:29 AM
sudo /usr/bin/chroot /home/chroot /bin/su - xxx| /bin/su: user xxx does not exist saavik Linux - General 3 07-04-2007 10:30 AM
mount command not working in chroot. and now chroot not working mohit.jain Linux From Scratch 5 07-14-2006 03:57 AM
chroot wrongman Linux - Security 2 07-15-2004 02:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:51 PM.

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