How to edit fstab?

Support for security such as Firewalls and securing linux
agriz
Posts: 267
Joined: 2011/11/19 15:17:40

How to edit fstab?

Post by agriz » 2013/10/04 13:39:58

I just read in cenos wiki the following

[code]

/dev/VG_OS/lv_root / ext3 defaults 1 1
/dev/VG_OS/lv_tmp /tmp ext3 defaults,nosuid,noexec,nodev 1 2
/dev/VG_OS/lv_vartmp /var/tmp ext3 defaults,nosuid,noexec,nodev 1 2
/dev/data_vol/lv_home /home ext3 defaults,nosuid,nodev 1 2
/dev/VG_OS/lv_var /var ext3 defaults,nosuid 1 2
/dev/data_vol/lv_web /var/www ext3 defaults,nosuid,nodev 1 2
/dev/sda1 /boot ext3 defaults,nosuid,noexec,nodev 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/_VG_OS/lv_swap swap swap defaults 0 0

[/code]

can i just type

[code]vi /etc/fstab[/code]

to make the changes in the file?
is it just making text edits on the file? or executing commands?

Additionally what is the meaning for the first column? Is it just some lables which can be edited?

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: How to edit fstab?

Post by gerald_clark » 2013/10/04 14:18:45

man fstab

If you don't know what you are doing, don't mess with it.

agriz
Posts: 267
Joined: 2011/11/19 15:17:40

Re: How to edit fstab?

Post by agriz » 2013/10/04 14:26:40

[quote]
gerald_clark wrote:
man fstab

If you don't know what you are doing, don't mess with it.[/quote]

I don't know what am i doing.
But where can i know those things? :(

The second and third columns are not editable.
They are the partitions and its types.

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: How to edit fstab?

Post by gerald_clark » 2013/10/04 14:52:08

You need to read:
http://www.centos.org/modules/newbb/viewforum.php?forum=47
https://access.redhat.com/knowledge/docs/

Beginners Linux: http://rute.2038bug.com/index.html.gz

agriz
Posts: 267
Joined: 2011/11/19 15:17:40

Re: How to edit fstab?

Post by agriz » 2013/10/04 15:35:48

Thanks for the bigger linux link.

Well,

[code]
UUID=a674c840-19c7-4d2e-a44c-ee0ea6028e42 /boot ext4 defaults 1 2
[/code]

If i directly edit the fstab with vim editor

[code]
UUID=a674c840-19c7-4d2e-a44c-ee0ea6028e42 /boot ext4 defaults,nosuid,noexec,nodev 1 2
[/code]


or

[code]
mount -o defaults,nosuid,noexec,nodev,remount UUID=a674c840-19c7-4d2e-a44c-ee0ea6028e42 /boot
[/code]

what is the difference?

I didn't try the mount command.
Is that right?


In the first column,

none
UUID=..
/dev/hda1

What is the difference?

/dev/hda1 is the partition which will be mounted on "/" or "/boot" or something. What about the others?


if it is none in the first column, should i mount it like this?
[code]
mount -o defaults,nosuid,noexec,nodev,remount none /boot
[/code]

What if there are two none in the first column?
Can the first column have same lable?

Thanks for helping me

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: How to edit fstab?

Post by gerald_clark » 2013/10/04 15:46:37

Don't mess with fstab unless you have a good reason.
You have not given a good reason.

agriz
Posts: 267
Joined: 2011/11/19 15:17:40

Re: How to edit fstab?

Post by agriz » 2013/10/04 15:50:07

wiki centos starts the security with fstab

User avatar
TrevorH
Forum Moderator
Posts: 22789
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to edit fstab?

Post by TrevorH » 2013/10/04 15:52:23

Did you read `man fstab`? It answers most questions about what the various fields mean.

agriz
Posts: 267
Joined: 2011/11/19 15:17:40

Re: How to edit fstab?

Post by agriz » 2013/10/04 15:56:03

[quote]
TrevorH wrote:
Did you read `man fstab`? It answers most questions about what the various fields mean.[/quote]

Am i wrong with my examples?
..
Yes, I read the man fstab

[code]This field describes the block special device or remote filesystem to be mounted.[/code]

I didn't find the "none" meaning for the first field.

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: How to edit fstab?

Post by gerald_clark » 2013/10/04 16:21:19

If you ask a specific, pertinent question instead of making random undocumented statements, you might get a good answer.

Locked