Tag Info

New answers tagged

1

While Anthon's answer is technically correct, I'm writing this one to explain where Octal Permissions come from, and how to calculate them. Octal Permissions is one of the most important concepts in the *nix world. Why This Concept is Important Since the Birth of Unix Circa 1969 -1974 on a discarded DEC PDP-7 (see photo and history) and Linus Torvalds ...


1

Changing the login shell does not necessarily prevent users from authenticating (except in some services that check if the user's shell is mentioned in /etc/shells). People may still be able to authenticate to the various services that your system provides to unix users, and may still be authorized to perform some actions albeit probably not run arbitrary ...


1

You can use chsh command: ~# chsh myuser Enter new shell details when requested: Login Shell [/bin/sh]: /bin/nologin Or shorter version: ~# chsh myuser -s /bin/nologin


3

For a user someusername to be able to write in folder, that was initially made by root, you need to change the rwx permissions and/or the owner resp. group. If you restrict the permissions then someusername needs to be either owner or group member. If you do chmod 777 /somefolder, everyone can read and write, including someusername. If you do chmod 770 ...


0

Here is a piece of code to replace the user/group with ids on the fly: tar ca --owner="$(id -u ***otherowner***)" --group="$(id -g ***othergroup***)" mydata.tgz mydata


0

this is the old school approach... most nix systems maintain group information into a plain textfile /etc/group, where group members are included within the group line entry, delimited by the :* character. now suppose you want to remove a user named myuser from a group mygroup, start by backing up /etc/group, then use the editor of your preference to ...


0

This one-liner will work: grep -Ev $(users | sed 's/ /|/g') /etc/passwd | awk -F: {'print $1'} How it works: The output of users | sed 's/ /|/g' will give you a | separated list of logged in users. The -E option with grep will allow us to use more than one string (in OR condition) to match. The -v option will print out what does not match given ...


4

Listing out groups of users You can get a list of all your local users with this command: $ getent passwd | awk -F: '{print $1}' NOTE: getent will return local users assuming you do not have sssd (or some similar service running which pulls LDAP users in too) and your /etc/nsswitch.conf is restricted to files, i.e. it's not including things like NIS or ...


1

You may want to write a script that will store the number of users currently logged in a file and the total users in another file and do a comm over them. For example: #!/bin/bash w | awk 'NR > 2 {print $1}' | sort > logged.txt #sorted list of logged users awk -F':' '{ print $1}' /etc/passwd | sort > allusers.txt #sorted list of all users comm ...


2

Check command w: w displays information about the users currently on the machine, and their processes. The header shows, in this order, the current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes. The following entries are displayed for each ...


3

As root you can change any users password by using the "passwd" command followed by the username; passwd username This will then prompt you to enter the new password twice. To clarify there is no way to see an existing users password.


0

Its quite easy task you simply have to make some changes in /etc/passwd file. Simply you have to change the shell which is generally by default /bin/bash I.e you can login using this shell change it to /bin/nologin or /bin/false. It is advisable to change it to /bin/nologin because /bin/false is outdated.


3

sudo command requires password of current user, not root user. If you wish to authorize by root password you can just use su -.


1

A better way to get local users might be to see if the user has a valid login shell: getent passwd | grep -f /etc/shells Here's something that should work: getent passwd | grep -f /etc/shells | tr ',' ':' | \ awk -F: '{print $1, $5}' | while read USER NAME do echo $NAME:$(chage -l $USER| awk -F': ' '/Password expires/{print $2}') ...


0

cut -d: -f1,3,5 /etc/passwd | while IFS=: read -r user userid fullname do if [ "$userid" -gt 500 ]; then echo "Full Name: $fullname" echo "Password Expiry date: $(chage -l "$user" | head -2 | tail -1)" fi done I am just adding the extra step on checking for the local users as /etc/passwd file normally contains the system users as well ...


0

You can use xargs to iterate through the results like this: $ grep '/home' /etc/passwd | cut -d: -f1 | xargs -n1 -I{} chage -l {} | \ grep "Password expires" | column -t Password expires : never In this variation we're calling xargs with the -n1 switch so it'll only call chage -l with a single username argument. The -I{} tells xargs to use {} as a ...


0

Part 3 of 3 (from here): sudo lxc-list to list the containers. If there's one listed, you might start it and see if your user is there. As for whether you were working in a snapshot, that would imply that some virtualization was operating. Outside of looking for KVM: sudo dpkg -l | grep -i kvm, this is outside of the scope of the OS.


1

If you have root, try chsh --shell /bin/bash raoming where chsh : change shell --shell /bin/bash tel to use /bin/bash roaming : your user.


1

man 8 nologin There is your real answer as to why it isn't working. If you want the user to log in then you need to give them a shell like /bin/bash or something else. You can edit /etc/passwd directly or use usermod -s /bin/bash roaming, all of this needs to be done as root.



Top 50 recent answers are included