Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
What if I symlink /root to /home/root?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
fpemud
Apprentice
Apprentice


Joined: 15 Feb 2012
Posts: 289

PostPosted: Sat Aug 17, 2019 3:32 pm    Post subject: What if I symlink /root to /home/root? Reply with quote

I'm going to create partitions for /home, /var and mounted / readonly.
Can I move /root into /home and symlink /root to /home/root? Creating a small partition for /root feels awkward.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7501
Location: Saint Amant, Acadiana

PostPosted: Sat Aug 17, 2019 4:37 pm    Post subject: Reply with quote

Wouldn't it be more elegant to set root's home to /home/root ?
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6342

PostPosted: Sat Aug 17, 2019 5:31 pm    Post subject: Re: What if I symlink /root to /home/root? Reply with quote

fpemud wrote:
Creating a small partition for /root feels awkward.

Being unable to log into your system at all because a normal user has a runaway ~/.xsession-errors would be more awkward. Root is separate for a reason.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7501
Location: Saint Amant, Acadiana

PostPosted: Sat Aug 17, 2019 7:05 pm    Post subject: Reply with quote

Hm, that's an argument against disabling root account and using sudo for root access. With root account enabled no user created mess can stop me from logging in as root and cleaning it up.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 44921
Location: 56N 3W

PostPosted: Sat Aug 17, 2019 7:18 pm    Post subject: Reply with quote

fpemud,

/root is on / for a reason too. To be able to log in, ste system needs the users home directory, or al least some space writable by that user.
With /root on /home, you need boot media to recover from a failure no mount /home.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7501
Location: Saint Amant, Acadiana

PostPosted: Sat Aug 17, 2019 7:24 pm    Post subject: Reply with quote

NeddySeagoon, I dispute this. I have /home in a different hard drive and I still can log in as user when this drive fails to mount.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 44921
Location: 56N 3W

PostPosted: Sat Aug 17, 2019 7:50 pm    Post subject: Reply with quote

Jaglover,

Yes you can. The /home mount point serves the purpose.
They system will be most unhappy though and tell you that it couldn't do things properly.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
mike155
Veteran
Veteran


Joined: 17 Sep 2010
Posts: 1982
Location: Frankfurt, Germany

PostPosted: Sat Aug 17, 2019 11:21 pm    Post subject: Reply with quote

Quote:
Can I move /root into /home and symlink /root to /home/root?

Of course you can do that - but you'll have to live with the consequences :roll:

Just an example: log in as 'root' on a machine where root's own directory is '/root'.
Code:
cd /
ln -s /root /a
find /root -name "*"
find /a    -name "*"
rm a

Do you see the difference in the output of the two find statements?

Unfortunately, some commands work exactly like this. They won't work as expected if /root is a symlink to some other directory.
Back to top
View user's profile Send private message
mirekm
Apprentice
Apprentice


Joined: 12 Feb 2004
Posts: 192
Location: Gliwice

PostPosted: Sun Aug 18, 2019 7:32 am    Post subject: Reply with quote

Better solution would be usage of
Code:
mount -o bind /home/root /root


I use it with ro root filesystem. In case of damage of home, I still have possibility to login of root if I mount / with rw.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum