1

I can't seem to (re)make a home directory. A script partially removed the account but it's not quite dead yet. I should probably just finish killing the account and remake it but in the meantime I'd like to figure out what's going on here. How do I do the needful to recreate this user home directory?

gsamsa@kafka:/> cat /etc/os-release 
NAME="SLES"
VERSION="15-SP3"
VERSION_ID="15.3"
PRETTY_NAME="SUSE Linux Enterprise Server 15 SP3"
ID="sles"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:15:sp3"
DOCUMENTATION_URL="https://documentation.suse.com/"

gsamsa@kafka:/> id
uid=1000(gsamsa) gid=100(users) groups=100(users)

gsamsa@kafka:/> echo $HOME
/home/gsamsa

gsamsa@kafka:/> ls -la /home
total 0
drwxr-xr-x 2 root root   0 Jan 24 17:20 .
drwxr-xr-x 1 root root 202 Jan 22 16:51 ..

gsamsa@kafka:/> cd
-bash: cd: /home/gsamsa: No such file or directory

gsamsa@kafka:/> mkdir $HOME
mkdir: cannot create directory ‘/home/gsamsa’: Permission denied

gsamsa@kafka:/> sudo mkdir $HOME
mkdir: cannot create directory ‘/home/gsamsa’: Permission denied

gsamsa@kafka:/> sudo mkhomedir_helper $HOME
gsamsa@kafka:/> echo $?
8

gsamsa@kafka:/> sudo useradd -m -d $HOME $( whoami )
useradd: user 'gsamsa' already exists

gsamsa@kafka:/> cd
-bash: cd: /home/gsamsa: No such file or directory

gsamsa@kafka:/> grep $( whoami ) /etc/passwd
gsamsa:1000:100:gsamsa:/home/gsamsa:/bin/bash

gsamsa@kafka:/> 

Update1: turns out trying to create other accounts also ends up with the same "can't create directory /home/username" problem.

Update2: Not read-only. I was able to create files, just not directories.

kafka:~ # mount | grep /home
/dev/sda2 on /home type btrfs (rw,relatime,space_cache,subvolid=264,subvol=/@/home)
auto.home on /home type autofs (rw,relatime,fd=29,pgrp=20218,timeout=43200,minproto=5,maxproto=5,indirect,pipe_ino=183332)
/dev/sda2 on /home type btrfs (rw,relatime,space_cache,subvolid=264,subvol=/@/home)

kafka:~ # touch /home/foo
kafka:~ # mkdir /home/gsamsa
mkdir: cannot create directory ‘/home/gsamsa’: File exists

kafka:~ # ls -la /home /home/foo
drwxr-xr-x 1 root root 18 Jan 24 18:02 /home
-rw-r--r-- 1 root root  0 Jan 24 18:02 /home/foo

Update 3: The directory showed up sometime after writing Update 2 but before I hit "Save edits." And I'm able to create other users. I had logged out of the gsamsa account which must of released some sort of deadlock. Sigh.

1 Answer 1

0

This:

gsamsa@kafka:/> sudo mkdir $HOME
mkdir: cannot create directory ‘/home/gsamsa’: Permission denied

Most often happens then the /home is mounted on a read-only drive. A network one or live-CD as most common examples.

1
  • ro filesystem gives: mkdir: cannot create directory ‘/home/gsamsa’: Read-only file system Jan 24 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.