Changing Primary User UID

My user & group id is “user:x:1000:1000” & dialout is “dialout:x:1001:1000”
No idea why it’s like that unless that’s normal for Manjaro.

This all works fine but is it normal for the user to not be 1001?

The only reason it’s an issue is when I mount one of my many Rpi image SD’s I can’t paste files to the SD because the same user on the SD is “user:x:1001:1001”

Is it too risky to change my Manjaro user & group id’s to 1001?

Thanks. Paul

Wouldn’t it be far easier to
chown -R user:group /mountpoint_of_sd
?
to change the rights on the filesystem, to allow you to write to it?

That’s because you have (or had) autologin enabled. Without autologin, the UID:GID of the primary user is 1000:1000.

You can do that, but then you also have to make sure that you chown all of your user’s own files to the new UID and GID. Or, you can use @Nachlese’s suggestion instead. :wink:

Yes that is normal. The first created user has always ID 1000. As you see in that summary: Users, Groups, UIDs and GIDs on systemd Systems regualar user can have numbers from 1000 to 60000.

Not really… in general:

  1. Switch to rescue target:
systemctl isolate rescue.target
  1. Change the UID/GID
usermod --uid 1001 username
groupmod --gid 1001 groupname
  1. Update your home files:
chown -Rv 1001:1001 /home/username/
  1. Exit rescue and boot to default:
exit

But anyway… it is better adding yourself to the same group as changing yourself. So:

usermod --append --groups groupname username

and add write permission to the group:

chmod -R g+rw /target

:notebook: Since your user and dailout share the same GID, you just have to add write permissions to the group on the target … thats it.

Thanks for the replies, everyday is a school day, at least I have learnt more about permissions!

@Aragorn That all makes sense

@Nachlese Certainly easy & works a treat, however I then do need to revert the permissions when the SD is back in the target Rpi & it’s not always files in one dir so I risk missing some

@megavolt I will think about the changes to the UID & perhaps try this after my next full backup.

As the “dialout” user is currently “1001” presumably I would have to change this first to release the UID to be assigned to my user.

I don’t really want to do something that means all my Rpi images need changing so this would be the best solution.

I couldn’t make “chmod -R g+rw /target” work even with a reboot (on either a dir or file). As you say both users are members of the same group already.

Meanwhile I can continue copying files across the network. Making compressed image files & burning back to SD’s works a treat using “dd” so I have a good working setup, just this slight niggle.

/target means the directory where you mount your Rpi-SD’s, think before you copy paste stuff… :woman_facepalming:

Anyhow i don’t know how you mount your Rpi-SD’s, but if you use systemd-mount you could use the option to mount it with your own user and group id’s instead…

systemd-mount -o uid=xxxx,gid=xxxx devpath mountpoint

Thanks but i’m not that daft, i did use the directory path :innocent:

It didn’t work because of course i am already a member of group 1000 & thinking about it a bit more during afternoon tea, there is no group 1001 except on the Rpi’s. So i created a new group 1001 & added myself which now lets me write files to the SD.

Not a solution though as my Rpi images (i have about a dozen different project images) don’t have user or group UID 1000. The only way is to change my Manjaro to match or carry on as I am which is not a great hardship.

Thanks for the replies

Erm… no. That is a file system depended option and doesn’t work on ext4, for example. NTFS/FAT32 should work and many others which are not Linux file systems.

2 Likes

Ahh indeed, i shouldnt’t reply at late hours :smiling_face:
But anyhow it might come handy for reader in future that want to mount certain shares…