Hot answers tagged

122

Some commands (eg chown) can accept either a username or a numeric user ID, so allowing all-numeric usernames would break that. A rule to allow names that start with a number and contain some alpha was probably considered not worth the effort; instead there is just a requirement to start with an alpha character. Edit: It appears from the other responses ...


74

here is a test on ubuntu 14.04 using numbers: root@ubuntu:~# useradd 232 root@ubuntu:~# mkdir /home/232 root@ubuntu:~# chown 232.232 /home/232 root@ubuntu:~# passwd 232 Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully root@ubuntu:~# login c2 login: 232 Password: Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 4.4.0-22-...


9

A *Nix username is generally a 32 character long string created by the utility useradd. This is, as you said, a direct result of early Unix (BSD technically) standards. According to the FreeBSD Man Page passwd(5): The login name must not begin with a hyphen (`-'), and cannot contain 8-bit characters, tabs or spaces, or any of these symbols: ...


3

These folders are not made/used by the system during user creation because the system doesn't generate them. They are generated the package xdg-user-dirs-update (Ubuntu) and xdg-user-dirs (Fedora/RHEL). The file /usr/bin/xdg-user-dirs-update is run at logon and creates the files based on defaults in /etc/xdg/user-dirs.defaults, or if it exists $HOME/....


3

You can use ps together with awk to find the physical memory usage by a user: ps -U root --no-headers -o rss | awk '{ sum+=$1} END {print int(sum/1024) "MB"}' Here it prints memory used by root to the output.


2

Nowadays, on a correctly-configured system there shouldn't be any way of determining this. On a badly-configured system, you might see different behaviour when attempting to log in depending on whether the user you're trying to log in as exists or not. (Hopefully not in the messages returned, but perhaps in the timing of the responses.) In the past, finger ...


2

First sorry for my bad english. Lets show something for you using only unix concepts, cause i think it can help (or maybe not). Imagine that i want that the executable nano can be executed by every users, but must never run as the user that call its executable, but with a limited environment, with access to edit the apache configuration only or files in ...


2

nfs4 does not use uid numbers but usernames. You can add to your /etc/idmapd.conf [Translation] Method=static [Static] fred@remote = localfred where fred is the username on the remote, and localfred is the local username.


2

To give Tim access to iptables, you can edit /etc/sudoers, with visudo: tim ALL=NOPASSWD: /sbin/iptables This will allow him to used the iptables as root without inputing his password. The path is full, for security reasons, otherwise if only iptables as you have, Tim would be able run any binary called iptables as root, and would be enough to create a ...


2

Lets say your file is named just file. This script will do the job: USERNAME=$(cat file | cut -d: -f1) echo "$USERNAME" ID=$(cat file | cut -d: -f2) echo "$ID" USER_SHELL=$(cat file | cut -d, -f2 | cut -d: -f2) echo "$USER_SHELL" useradd -m -s "$USER_SHELL" -u "$ID" "$USERNAME"


1

This is a bare minimum script to get the job done. It makes sure that neither the username nor the uid is already in use. It makes a matching group for each user (with gid=uid) - it doesn't check if the gid or group name already exists (left as an exercise for the reader - hint: use getent group). Note: the script below is untested but I've written ...


1

"root" (aka "superuser") is the name of the system administrator account. The origins of the name are a little archaic, but that doesn't matter. Root user has user id 0 and nominally has unlimited privileges. Root can access any file, run any program, execute any system call, and modify any setting. (But see below┬╣). Prior to the invention of the "sudo" ...


1

Is there a technical reason why? Is this an artifact from the early days of Linux or Unix, and if so is there a reason why it persists? I cannot think of a technical reason - historically, it's just ASCII. How it is read in and then typed is in the hands of the coder. unix-history-repo/usr/src/cmd/passwd.c char *uname; insist = 0; if(argc < 2) { ...


1

I think smem is the better tool in your case. Install smem and try smem -uk If you are using debian you can install it using: apt-get install smem If you cant install nothing on the server you can try: ps haux | awk -v user=$USER '$1 ~ user { sum += $4} END { print user, sum; }' Remember that $USER is a environment variable so you don't need to ...



Only top voted, non community-wiki answers of a minimum length are eligible