Cannot log on with 1 user account 'gla' getting the msg "(bash: /home/gla/.bashrc: Permission denied"

  1. I’m a newbee to Linux.
    I have created multiple accounts on my system and I have (tried) to create 1 additional user with admin rights. When I try to log on with that user, using the Terminal I get this
    [gerit@pc-buro-3 ~]$ su gla
    Password: 
    bash: /home/gla/.bashrc: Permission denied

I have create other users as well and I have no problems to login with these users.

The process I used to create the ‘gla’ user was as follows:

  1. I used the xfce GUI “User Account” to create the user gla
  2. Not being able to specify the Account Type , I added the user gla to the group wheel.
    I forgot how I did this but I remember vaguely, I updated a config file somewhere to
    add gla to the group wheel. (I was not confident in using the -G, -g or -a options on the usermod command. Using the command groups I can see…
       [gla@pc-buro-3 gerit]$ groups gla
       wheel audio lp optical video sys network scanner power gla

Kernel: 5.15.57-2-MANJARO

What are its permissions then?

sudo ls -l /home/gla/.bashrc

That’s because you are using su instead of su - or su -l. The correct commands would have been either… :arrow_down:

su - gla

… or … :arrow_down:

su -l gla

The rationale is that if you use su “as is”, then you will still be operating from within the user environment of the invoking user. If on the other hand you do it as I showed you here-above, then you are effectively logging into that user and their environment.

2 Likes

Thanks for your feedback. I again learned something.

 gerit@pc-buro-3 ~]$ su -l gla
  Password: 
  su: warning: cannot change directory to /home/gla: Permission denied
  -bash: /home/gla/.bash_profile: Permission denied
[gerit@pc-buro-3 ~]$ sudo ls -l /home/gla/.bashrc
-rw-r--r-- 1 glc glb 3824 Jan 14  2022 /home/gla/.bashrc

it seems that glc is the owner…?

File: /home/gla/.bashrc
  Size: 3824      	Blocks: 8          IO Block: 4096   regular file
Device: 8,1	Inode: 38277715    Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1001/     glc)   Gid: ( 1001/     glb)

So I tried this…

[gerit@pc-buro-3 home]$ sudo  chown gla -hR /home/gla
[gerit@pc-buro-3 home]$ sudo ls -l /home/gla/.bashrc
-rw-r--r-- 1 gla glb 3824 Jan 14  2022 /home/gla/.bashrc

Thanks for your help
This command the trick :

sudo ls -l /home/gla/.bashrc

I saw that the dir /home/gla was owned by another user “glb”
Using command chown -hR /home/gla I managed to get the logon to work.
Thx for your support, folks!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.