How to edit fstab?

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

Re: How to edit fstab?

Postby agriz » 2013/10/04 16:24:52

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


Can you give me an example specific, pertinent question related with fstab modification.
I didn't get you clearly.

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

Re: How to edit fstab?

Postby gerald_clark » 2013/10/04 16:34:21

You have not given any reason for your fstab change, nor any description of what you want to change.
When you come back with a real documented question, I may respond..

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

Re: How to edit fstab?

Postby agriz » 2013/10/04 17:02:11

gerald_clark wrote:
You have not given any reason for your fstab change, nor any description of what you want to change.
When you come back with a real documented question, I may respond..


I am reading everywhere that securing fstab is important.
Centos wiki is also recommending changing fstab.

i just read the ubuntu forum.

Code: Select all

sudo vi /etc/fstab


Which means, i guess, we can edit the fstab and make the changes as described in the centos wiki (securing centos)

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

Re: How to edit fstab?

Postby agriz » 2013/10/04 17:11:08

/***
off-topic question
***/

I am sure you must have used lot of linux distributions.
From you experience which server do you recommend?

Centos or Ubuntu? (for a beginner)

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

Re: How to edit fstab?

Postby TrevorH » 2013/10/04 18:42:54

I don't see a "none" in the first field of your fstab (nor any of mine either come to that).

In `man 5 fstab` I see documentation for none in the 2nd and 3rd fields but not for the first..

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

Re: How to edit fstab?

Postby agriz » 2013/10/05 05:17:59

My first post on this topic is sample fstab which is secured.

I have a centos minimal on my computer

the fstab on my computer is

Code: Select all

/dev/mapper/Vol.._root / ext4 defaults 1 1
UUID=....0d5 /boot ext4 defaults 1 2
/dev/mapper/.. /home ext4 defaults 1 2
/dev/..swap swap swap defaults 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


So how do i add the /tmp /var/ /var/www in fstab?
How do i change /home /boot and others defaults values?

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

Re: How to edit fstab?

Postby agriz » 2013/10/05 06:26:04

Code: Select all

http://www.cyberciti.biz/faq/howto-mount-tmp-as-separate-filesystem-with-noexec-nosuid-nodev/


The above link tells how to modify the fstab. How to add tmp in fstab as a separate file system!

Code: Select all

mount -o remount,nosuid,nodev /home
mount -o remount,nosuid,noexec,nodev /boot


If there is any mistake let me know.
If it is possible, let me know how to add /var /var/www on the fstab

Thanks for helping

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

Re: How to edit fstab?

Postby TrevorH » 2013/10/05 07:52:46

To create new separate filesystems is more complicated than just adding an entry to /etc/fstab. First, you need to create a new partition or a new Logical Volume and format it using the mke2fs command. Then you have to temporarily rename the original location that you want to move to a separate mount point, create a new directory called what you want it to be mounted as, mount the new filesystem there, copy all the data over from the old location to the new, add the fstab entry, umount the new mountpoint and run `mount -a` to check that it mounts correctly (this is what it does during boot up for you). If we're talking about a new /tmp then you also need to set the permissions to 1777 on the new mount point.

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

Re: How to edit fstab?

Postby agriz » 2013/10/05 08:02:08

I used mkfs.ext4 to format
what is the difference between 0777 and 1777?

I used 0777

mount -a returns nothing for me!

Code: Select all

mount -o remount,nosuid,nodev /home
mount -o remount,nosuid,noexec,nodev /boot


Is this two command right?

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

Re: How to edit fstab?

Postby TrevorH » 2013/10/05 15:01:27

what is the difference between 0777 and 1777?


`man chmod` details the various bit settings but the 1 is 'sticky'. It's required for /tmp

mount -a returns nothing for me!


Means there were no errors while mounting all available filesystems in fstab