root用户登录时,/root文件夹的数据如何自动挂载到/home所在分区

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
eaglewarrior
帖子: 7
注册时间: 2011-04-29 13:53

root用户登录时,/root文件夹的数据如何自动挂载到/home所在分区

#1

帖子 eaglewarrior » 2011-05-01 0:00

自开启root用户后,就很少用那个装Ubuntu时建的用户名登录。但我的“/home”单独挂了个40GB的较大分区,本用来存各类数据。可用root用户登录后,各类数据默认保存在“/”所挂分区的/root文件夹,而我这个“/”区只分了15GB,心想用来存些程序应该够了。现在用root登录的多,请问大家有没有办法让/root文件夹的内容自动保存在/home所挂的分区啊
头像
monk
帖子: 19507
注册时间: 2010-01-28 10:45

Re: root用户登录时,/root文件夹的数据如何自动挂载到/home所在分区

#2

帖子 monk » 2011-05-01 0:10

root用户下建个文件夹 把/home的分区挂上

*********宁静致远*********
如果我说的有什么不对,请看签名第一行
头像
monk
帖子: 19507
注册时间: 2010-01-28 10:45

Re: root用户登录时,/root文件夹的数据如何自动挂载到/home所在分区

#3

帖子 monk » 2011-05-01 0:11

新手不建议用 root用户

*********宁静致远*********
如果我说的有什么不对,请看签名第一行
头像
pointer指针
帖子: 3429
注册时间: 2011-02-25 23:23

Re: root用户登录时,/root文件夹的数据如何自动挂载到/home所在分区

#4

帖子 pointer指针 » 2011-05-01 0:21

还是没事干不要root的好……
希望能够有学上
eaglewarrior
帖子: 7
注册时间: 2011-04-29 13:53

Re: root用户登录时,/root文件夹的数据如何自动挂载到/home所在分区

#5

帖子 eaglewarrior » 2011-05-01 0:25

新手用root用户有什么危险吗?容易不小心操作导致系统崩溃吗?现在基本处于抄别人代码执行的水平,虽自己想不到,但也在琢磨其所以然。麻烦告诉我怎么在root用户下建个文件夹 把/home的分区挂上
头像
monk
帖子: 19507
注册时间: 2010-01-28 10:45

Re: root用户登录时,/root文件夹的数据如何自动挂载到/home所在分区

#6

帖子 monk » 2011-05-01 0:30

去“教学和常见问答”看看 8哥的 fstab挂载

*********宁静致远*********
如果我说的有什么不对,请看签名第一行
头像
adagio
论坛版主
帖子: 22110
注册时间: 2008-02-17 23:47
来自: 美丽富饶的那啥星球

Re: root用户登录时,/root文件夹的数据如何自动挂载到/home所在分区

#8

帖子 adagio » 2011-05-01 0:36

有什么危险? 简单说吧,使用root账号作为日常使用,将使linux变得比windows还要脆弱,还要不堪一击,linux对windows的优势将不复存在
既然又危险、又没有windows的软件多、又不普及,那你用它做什么?
明天就换大三八!
——8核CPU、8G内存、8T硬盘……
8卡交火,80寸大屏放8个……
IPv8的光纤要8条……

---------------------------------------------------------------------------------
[图片版]新手当自强(续)FAQ
[新手进阶]挂载、fstab、调整linux分区
[图片版]E17桌面环境配置手把手
头像
pointer指针
帖子: 3429
注册时间: 2011-02-25 23:23

Re: root用户登录时,/root文件夹的数据如何自动挂载到/home所在分区

#9

帖子 pointer指针 » 2011-05-01 0:39

eaglewarrior 写了:新手用root用户有什么危险吗?容易不小心操作导致系统崩溃吗?现在基本处于抄别人代码执行的水平,虽自己想不到,但也在琢磨其所以然。麻烦告诉我怎么在root用户下建个文件夹 把/home的分区挂上
home分区了么?
fdisk -l 看看sdax (x是数字) 里面有没有和你的home分区的大小相符的
在root下新建个文件夹,然后终端以root执行:
mount /dev/sdax /root/file/of/your/directory
就可以把home挂载上去
其实你直接把你需要的文件copy过去就好了啊……或者link过去
干吗非要挂载呢
希望能够有学上
头像
onshoestring
论坛版主
帖子: 4666
注册时间: 2009-09-06 5:53

Re: root用户登录时,/root文件夹的数据如何自动挂载到/home所在分区

#10

帖子 onshoestring » 2011-05-01 0:43

直接mount可能不合适,因为分区挂栽到目录,就是说/home分区会挂载两次。
可以试试:
The bind mounts.
Since Linux 2.4.0 it is possible to remount part of the file
hierarchy somewhere else. The call is
mount --bind olddir newdir
or shortoption
mount -B olddir newdir
or fstab entry is:
/olddir /newdir none bind
头像
pointer指针
帖子: 3429
注册时间: 2011-02-25 23:23

Re: root用户登录时,/root文件夹的数据如何自动挂载到/home所在分区

#11

帖子 pointer指针 » 2011-05-01 0:49

onshoestring 写了:直接mount可能不合适,因为分区挂栽到目录,就是说/home分区会挂载两次。
可以试试:
The bind mounts.
Since Linux 2.4.0 it is possible to remount part of the file
hierarchy somewhere else. The call is
mount --bind olddir newdir
or shortoption
mount -B olddir newdir
or fstab entry is:
/olddir /newdir none bind
嗯嗯,受教 :em11
希望能够有学上
头像
onshoestring
论坛版主
帖子: 4666
注册时间: 2009-09-06 5:53

Re: root用户登录时,/root文件夹的数据如何自动挂载到/home所在分区

#12

帖子 onshoestring » 2011-05-01 1:03

pointer指针 写了:
onshoestring 写了:直接mount可能不合适,因为分区挂栽到目录,就是说/home分区会挂载两次。
可以试试:
The bind mounts.
Since Linux 2.4.0 it is possible to remount part of the file
hierarchy somewhere else. The call is
mount --bind olddir newdir
or shortoption
mount -B olddir newdir
or fstab entry is:
/olddir /newdir none bind
嗯嗯,受教 :em11
不敢当,其实都是man的结果。
回复