You are not logged in.

#1 2011-04-15 20:09:50

GillesM
Member
Registered: 2011-04-15
Posts: 3

Arch way of chmod-ing tmpfs vs...

1) Here's what Arch Linux suggests for mounting /tmp as a tmpfs:

"To use tmpfs for /tmp, (...), add these lines to /etc/fstab":

tmpfs /tmp      tmpfs defaults,nodev,nosuid,mode=1777

https://wiki.archlinux.org/index.php/Fstab

Here's what funtoo suggests to create a tmps of 1G:

tmpfs   /dev/shm        tmpfs   size=1g        0       0

would create a tmps of 1G.

I suppose mounting a tmpfs on /dev/shm would disable /tmp but what about the absence of nodev,nosuid,mode=1777 ?

One could think that it's an incomplete "suit your need" recipe, but this is usually not Daniel Robbins' way of doing things. I tried to get information on funtoo forums and I couldn't get any.


2)

For /var/lock Arch suggests:

tmpfs /var/lock tmpfs defaults,nodev,nosuid,noexec,mode=1777

By default, in mtab, Ubuntu systems have:

none /var/lock tmpfs rw,noexec,nosuid,nodev 0 0

Is this really equivalent? Ubuntu has, I guess, 0775 as permissions...

I don't know where Ubuntu sets those permissions.

Just trying to get a deeper understanding of mounting and to eliminate guesswork. I'm sure Ubuntu users would have a 1000 answers on this, but...

Offline

#2 2011-04-15 20:45:46

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: Arch way of chmod-ing tmpfs vs...

Your funtoo example is not mounting it to /tmp. The corresponding Arch entry from fstab defaults is

shm   /dev/shm   tmpfs   nodev,nosuid

nodev and nosuid are generic mount options.

Anyways I think you are looking at this all wrong. It's not, "what is $distro way of doing this?" It's what is YOUR way of doing this. Read the man pages (for mount in particular) and the documentation for the file systems. Figure out which options suit you the best and stop trying to figure which distro has the better defaults. Unless that is what you are doing in which case please phrase your questions better. Thank you, have a nice day. ^_____^


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#3 2011-04-16 00:17:13

GillesM
Member
Registered: 2011-04-15
Posts: 3

Re: Arch way of chmod-ing tmpfs vs...

fsckd wrote:

Your funtoo example is not mounting it to /tmp.

It doesn't matter.

First, as you say, nodev, nosuid is default (For "user, group, world". "users" is different).

As for permissions:

ls -l /dev | grep shm
drwxrwxrwt  2 root root          80 2011-04-15 19:30 shm

ls -l / | grep tmp
drwxrwxrwt  17 1777 root  4096 2011-04-15 19:09 tmp

(Please note that I don't have /tmp mounted as tmpfs, yet)

ls -l /var | grep lock
drwxrwxrwt  2 root root

it seems tmpfs will adopt permissions of any existing directory.

Isn't the RTFM motto you serve me just an admission that you didn't know this basic fact? Why not just answer what you know? (See Note1)

As "Arch (...) includes and permits use of System V runlevels" -Wikipedia

maybe some of you know where System V makes its mounting?

By this I mean, in mtab, I have:

none /var/lock tmpfs rw,noexec,nosuid,nodev 0 0

nothing about /var/lock in fstab

I understand fstab is OK, but where does the system do the work.

Note1:
In my opinion, man pages, and mainly for complex commands such as mount, are no use to the non-savvy. In order to grab the meaning, you have to have a general understanding of how the system works. Only then does man pages deliver some detail that a sysadmin might need. Sometimes, I get only get to understand how a command works when I read the exemples at the end. mount, because of its complexity, provides none.

Certainly, for a desktop, mounting /tmp as a tmpfs was fairly standard procedure, I thought. So, wasn't giving 2 examples of 2 distros doing it apparently differently, the best way to get to the point. Maybe this could help pther Linux users. Check all the nonsense on the net! (I won't discuss this further.)

Thanks for your help.

Last edited by GillesM (2011-04-16 00:21:56)

Offline

#4 2011-04-16 04:30:33

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: Arch way of chmod-ing tmpfs vs...

GillesM wrote:

I suppose mounting a tmpfs on /dev/shm would disable /tmp but what about the absence of nodev,nosuid,mode=1777 ?

Why would you think having /dev/shm disables /tmp? It doesn't.

And please do not put down those who reply to your posts. Archers are expected to self-help, some man pages require prior knowledge but google certainly does not.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#5 2011-04-16 05:09:54

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: Arch way of chmod-ing tmpfs vs...

There seems to be some miscommunication between us. My main point is in the two sentences preceding RTFM. I won't press that further other than please have patience and try to clarify instead of assuming my motivations. You don't know what I know and I certainly don't know what you may know.

GillesM wrote:

it seems tmpfs will adopt permissions of any existing directory.

I'm not sure what you mean by this but taken literally you are totally wrong. Example,

mkdir ~/testmnt ; sudo mount -t tmpfs tmpfs ~/testmnt ; ls -ld ~/testmnt

What do you see?

As "Arch (...) includes and permits use of System V runlevels" -Wikipedia

maybe some of you know where System V makes its mounting?

By this I mean, in mtab, I have:

none /var/lock tmpfs rw,noexec,nosuid,nodev 0 0

nothing about /var/lock in fstab

I understand fstab is OK, but where does the system do the work.

Consider looking in /proc/mount instead of mtab.

I see your query on boot and raise you this.

Sometimes, I get only get to understand how a command works when I read the exemples at the end. mount, because of its complexity, provides none.

I suggested the mount man page because it also applies to fstab. The mount man page is unique in its accessibility. It is has the following general structure,
* basic info about command and fs types
* generic mount options
* fs specific mount options
* other stuff
You would probably want the fs specific options and generic mount options.

Thanks for your help.

You're welcome. ^_^


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#6 2011-04-16 22:14:36

GillesM
Member
Registered: 2011-04-15
Posts: 3

Re: Arch way of chmod-ing tmpfs vs...

fsckd wrote:

There seems to be some miscommunication between us. My main point is in the two sentences preceding RTFM. I won't press that further other than please have patience and try to clarify instead of assuming my motivations. You don't know what I know and I certainly don't know what you may know.

You see how I got permissions on subdirectories using grep instead of using the -d option as you did? This is how much I know.

GillesM wrote:

it seems tmpfs will adopt permissions of any existing directory.

I'm not sure what you mean by this but taken literally you are totally wrong. Example,

mkdir ~/testmnt ; sudo mount -t tmpfs tmpfs ~/testmnt ; ls -ld ~/testmnt

What do you see?

drwxrwxrwt

So, what? Just as for "nodev,nosuid", the permissions Arch uses (1777) are the default for tmpfs?

Consider looking in /proc/mount instead of mtab.

less /proc/mounts (note the "s")
none /var/lock tmpfs rw,nosuid,nodev,noexec,relatime 0 0

less /etc/mtab
none /var/lock tmpfs rw,noexec,nosuid,nodev 0 0

The only difference is proc has relatime.

I see your query on boot and raise you this.

System V doesn't have any rc.sysinit, but close:

rc-sysinit.conf

But just as rc.conf and rcS.conf, it  doesn't seem of much help.

Last edited by GillesM (2011-04-17 17:57:42)

Offline

Board footer

Powered by FluxBB