PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, May 15, 2022

[FIXED] Why to switch user when I am already in the group with the same name?

 May 15, 2022     linux, ubuntu     No comments   

Issue

On our ubuntu linux server: I got a permission error when access: /home/abc/data/. I was told I need to be added to the abc group. They added me. I am still having the same permission error when cd to that directory. Then they told me I have to sudo su - abc to switch to abc user to access that directory. Why do I have to su to abc since I am in the abc group already? Is abc a user, not a group? I am confused.


Solution

abc might be a user, or a group, or both -- which depends on how your system is set up, but generally on Ubuntu, every user has a corresponding group with the same name. So it is probably both a user and a group.

Accessing the directory in question might be a question of either user or group permissions. Try doing ls -ld /home/abc, which will show you the permissions on that directory. It will give you an output something like

drwxr-xr-x 248 abc   abc   16384 Feb 24 09:17 /home/abc

The letters at the beginning are the permissions. In this case the first rwx are the 'user' permissions (meaning the user abc has read, write, and execute permission here) while the second r-x are the 'group' permissions, (meaning group abc has read and execute permissions, but not write permissions).

If the group permissions are adequate for what you want to do, you need only be in group abc. If on the other hand, you need something only allowed by the user permissions, you need to be user abc. The latter is generally considered bad form and a mis-configuration.

To see what groups you are a member of, use the groups command.



Answered By - Chris Dodd
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing