You are not logged in.

#1 2025-05-01 10:20:27

lo7777799
Member
Registered: 2023-07-25
Posts: 52

chmod - how /home/user to standard ?

hello,

i have changed the settings from /home/user to an other rule. now i have some problems.

how can i change it to the rules, that an arch linux /home/user folder has at standard?

chmod -c -R ???? /home/user

can you say me, what 4 numbers i must wrote instead of "????" to make rules to the standard, that all users on a fresh linux system has, when that user was created for /home/user ?

and also the number for upper folder /home pls

please also say the number for sticky,SUID and SGID.

can you help me please? smile

Last edited by lo7777799 (2025-05-01 10:28:34)

Offline

#2 2025-05-01 10:48:25

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,736
Website

Re: chmod - how /home/user to standard ?

On Arch the default is to set home directories to 0700. For the files within, the default umask of 022 is applied (so 755 for directories, 644 for files)

/etc/login.defs wrote:
# Default initial "umask" value used by login(1) on non-PAM enabled systems.
# Default "umask" value for pam_umask(8) on PAM enabled systems.
# UMASK is also used by useradd(8) and newusers(8) to set the mode for new
# home directories if HOME_MODE is not set.
# 022 is the default value, but 027, or even 077, could be considered
# for increased privacy. There is no One True Answer here: each sysadmin
# must make up their mind.
UMASK		022

# HOME_MODE is used by useradd(8) and newusers(8) to set the mode for new
# home directories.
# If HOME_MODE is not set, the value of UMASK is used to create the mode.
HOME_MODE	0700

Mod note: Moving to NC.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2025-05-01 12:23:15

lo7777799
Member
Registered: 2023-07-25
Posts: 52

Re: chmod - how /home/user to standard ?

ok thanks,

what should i do to set /home to 0700 and umask to 022 and directories to 755 and files to 644 ?

Offline

#4 2025-05-01 14:04:41

seth
Member
Registered: 2012-09-03
Posts: 63,247

Re: chmod - how /home/user to standard ?

Not sure what you're asking, you apparently are aware of http://man.archlinux.org/man/core/coreutils/chmod.1.en

However, "$HOME" is supposed to be 700 - "/home" isn't - it defaults to 755

Offline

#5 2025-05-01 16:38:13

lo7777799
Member
Registered: 2023-07-25
Posts: 52

Re: chmod - how /home/user to standard ?

ok thanks, seth

and how can i make files to 0644 without making directories to change from 0700 to 0644 ? what is a "default umask"?

Offline

#6 2025-05-01 16:42:09

mackin_cheese
Member
Registered: 2025-01-07
Posts: 459

Re: chmod - how /home/user to standard ?

lo7777799 wrote:

ok thanks, seth

and how can i make files to 0644 without making directories to change from 0700 to 0644 ? what is a "default umask"?

You are an Arch user, you are expected to do research. You should be able to search the Arch Wiki for this information.

Offline

#7 2025-05-01 16:51:54

ozwigh
Member
Registered: 2014-10-07
Posts: 32

Re: chmod - how /home/user to standard ?

lo7777799 wrote:

and how can i make files to 0644 without making directories to change from 0700 to 0644 ? what is a "default umask"?

Use this simple script, for example, I named it np (normalize permissions, but you can name it as you wish).

#!/bin/bash

# directory permissions to set
DP=775
# file permissions to set
FP=664

if [ -z "$1" ]; then
	echo "usage: $0 name [name ...]" 2>&1
	exit 1
fi

for f in "$@"; do
    find "$f" -type d -exec chmod $DP {} \;
    find "$f" -type f -exec chmod $FP {} \;
done

Change DP and FP variables to what you desire. Then use it: np /home/<your-home-dir>. It's a very simple script, it doesn't check for existing x flags on files, so be careful if you have a bin directory in your home or, say, ".steam".

Offline

#8 2025-05-01 19:15:20

seth
Member
Registered: 2012-09-03
Posts: 63,247

Re: chmod - how /home/user to standard ?

Also read the chmod manpage, it has more abilities than setting numeric permissions.
Eg. it's possible to only alter permissions for the u|ser, the g|roup and o|thers and there's a way to alter the exXec bit depending on the file type.
Then also read http://man.archlinux.org/man/core/man- … mask.1p.en

Simply flattening permissions as in #7 is NOT a goto idea, eg. ssh is gonna be rather picky about access rights.
If you have only altered the permissions of your $HOME (not recursively), just change that back (not recursivly) - otherwise: what exactly have you done?

Offline

#9 2025-05-02 06:25:36

lo7777799
Member
Registered: 2023-07-25
Posts: 52

Re: chmod - how /home/user to standard ?

WorMzy wrote:

the default umask of 022 is applied (so 755 for directories, 644 for files

do you mean the umask from /etc/fstab ?

Offline

#10 2025-05-02 06:36:08

seth
Member
Registered: 2012-09-03
Posts: 63,247

Re: chmod - how /home/user to standard ?

See WorMzy's post again and also http://wiki.archlinux.org/title/Umask# … mask_value - the mount option is only relevant to non-posix FS, do keep your $HOME on ntfs or fat??

Offline

#11 2025-05-02 09:05:08

lo7777799
Member
Registered: 2023-07-25
Posts: 52

Re: chmod - how /home/user to standard ?

my /home is ext4.

Last edited by lo7777799 (2025-05-02 09:06:08)

Offline

#12 2025-05-02 14:13:53

seth
Member
Registered: 2012-09-03
Posts: 63,247

Re: chmod - how /home/user to standard ?

In which case the fstab parameters for ntfs, fat etc. are of course irrelevant.
Edit:

If you have only altered the permissions of your $HOME (not recursively), just change that back (not recursivly) - otherwise: what exactly have you done?

Last edited by seth (2025-05-02 14:14:22)

Offline

Board footer

Powered by FluxBB