How can I get groups, permissions, shell, etc from a desired user from command line?
There is a tool to obtain all basic data for each user?
I don't think there is a single unified command for this.
For most things, you can use the finger
command:
$ finger $USER
Login: root Name: root
Directory: /root Shell: /bin/bash
On since Thu Jan 15 13:46 (IST) on tty1 19 days 18 hours idle
Last login Tue Feb 3 20:55 (IST) on pts/5 from localhost
No mail.
No Plan.
You get the username, home directory, shell, count of unread mails, and last login details.
To list groups, either groups
or id
will do:
$ groups
muru adm cdrom sudo dip plugdev lpadmin sambashare debian-tor libvirtd autopilot socks
$ id
uid=1000(muru) gid=1000(muru) groups=1000(muru),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),108(lpadmin),124(sambashare),127(debian-tor),132(libvirtd),136(autopilot),999(socks)
Permissions, of course, depend on what they are for. For sudo
, use sudo -l
:
$ sudo -l
[sudo] password for muru:
Matching Defaults entries for muru on ica:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
User muru may run the following commands on ica:
(ALL : ALL) ALL
With PolKit it's a lot tougher, pkcheck
can assess whether an individual process can use some privilege, but I couldn't figure out a way to list all permissions.