131

The functionality you are looking for is implemented in glibc. You can define a custom hosts file by setting the HOSTALIASES environment variable. The names in this file will be picked up by gethostbyname (see documentation). Example (tested on Ubuntu 13.10): $ echo 'g www.google.com' >> ~/.hosts $ export HOSTALIASES=~/.hosts $ wget g -O /dev/null ...


94

Most unix systems prevent users from “giving away” files, that is, users may only run chown if they have the target user and group privileges. Since using chown requires owning the file or being root (users can never appropriate other users' files), only root can run chown to change a file's owner to another user. The reason for this restriction is that ...


65

I was looking for a way to run a program with modified DNS resolution for testing purposes. For me, the solution was using the HOSTALIASES environment variable: $ echo "foo www.google.com" >> ~/.hosts $ HOSTALIASES=~/.hosts wget foo See hostname(7). (Side note: In the example the HOSTALIASES environment variable only affects the wget process. Of ...


62

ulimit is made for this. You can setup defaults for ulimit on a per user or a per group basis in /etc/security/limits.conf ulimit -v KBYTES sets max virtual memory size. I don't think you can give a max amount of swap. It's just a limit on the amount of virtual memory the user can use. So you limits.conf would have the line (to a maximum of 4G of ...


61

In general, if a non-system installed and maintained binary needs to be accessible system-wide to multiple users, it should be placed by an administrator into /usr/local/bin. There is a complete hierarchy under /usr/local that is generally used for locally compiled and installed software packages. If you are the only user of a binary, installing into $HOME/...


57

Figures that I'd figure this out on my own. The clue was here, in the user service output: Dec 23 19:43:27 redmine systemd[613]: Reached target Default. My unit was asking to be loaded with multi-user.target, but there is no such target in the user systemd. I changed this to default.target in the unit file, disabled and re-enabled the service, and it now ...


50

You need to compile these from source. It should just be a matter of apt-get source PACKAGE ./configure --prefix=$HOME/myapps make make install The binary would then be located in ~/myapps/bin. So, add export PATH="$HOME/myapps/bin:$PATH" to your .bashrc file and reload the .bashrc file with source ~/.bashrc. Of course, this assumes that gcc is installed ...


43

The right to access a serial port is determined by the permissions of the device file (e.g. /dev/ttyS0). So all you need to do is either arrange for the device to be owned by you, or (better) put yourself in the group that owns the device, or (if Fedora supports it, which I think it does) arrange for the device to belong to the user who's logged in on the ...


43

The easiest way to do this is to install R from source: $ wget http://cran.rstudio.com/src/base/R-3/R-3.4.1.tar.gz $ tar xvf R-3.4.1.tar.gz $ cd R-3.4.1 $ ./configure --prefix=$HOME/R $ make && make install The second-to-last step is the critical one. It configures R to be installed into a subdirectory of your own home directory. To run it on ...


42

Beside the LD_PRELOAD tricks. A simple alternative that may work on a few systems would be to binary-edit a copy of the system library that handles hostname resolution to replace /etc/hosts with a path of your own. For instance, on Linux: If you're not using nscd, copy libnss_files.so to some location of your own like: mkdir -p -- ~/lib && cp /lib/...


41

There are a couple approaches, some of them mostly secure, others not at all. The insecure way Let any use run mount, e.g., through sudo. You might as well give them root; it's the same thing. The user could mount a filesystem with a suid root copy of bash—running that instantly gives root (likely without any logging, beyond the fact that mount was run). ...


40

The --disabled-password option will not set a password, meaning no password is legal, but login is still possible (for example with SSH RSA keys). To create an user without a password, use passwd -d $username after the user is created to make the password empty. Note not all systems allow users with empty password to log in.


40

Just add all needed commands to sudoers separately: %webteam cms051=/usr/bin/systemctl restart httpd.service %webteam cms051=/usr/bin/systemctl stop httpd.service %webteam cms051=/usr/bin/systemctl start httpd.service %webteam cms051=/usr/bin/systemctl status httpd.service


32

What you can do with perf without being root depends on the kernel.perf_event_paranoid sysctl setting. kernel.perf_event_paranoid = 2: you can't take any measurements. The perf utility might still be useful to analyse existing records with perf ls, perf report, perf timechart or perf trace. kernel.perf_event_paranoid = 1: you can trace a command with perf ...


32

Compile and install into ~/bin (and edit your .bashrc to set the PATH to include it). libraries can similarly be compiled and installed into ~/lib (set LD_LIBRARY_PATH to point to it), and development headers can be installed into e.g. ~/includes. Depending on the specific details of the programs you want to install and the libraries they depend upon, you ...


31

You've created a user with a “disabled password”, meaning that there is no password that will let you log in as this used. This is different from creating a user that anyone can log in as without supplying a password, which is achieved by specifying an empty password and is very rarely useful. In order to execute commands as such “system” users who don't ...


29

@jofel's answer was exactly what I needed to get a working setup. POsting this for anyone else stumbling on this question. I needed a way to have capistrano restart my Ruby application after deploying from my local machine. That means I needed passwordless access to restarting systemd services. THIS is what I have and it works wonderfully! Note: my user and ...


24

Private mountspaces created with the unshare command can be used to provide a private /etc/hosts file to a shell process and any subsequent child processes started from that shell. # Start by creating your custom /etc/hosts file [user] cd ~ [user] cat >my_hosts <<EOF 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 127....


24

Give the other users permission to kill the processes as the low priority user through sudo -u lowpriouser /bin/kill PID A user can only signal their own processes, unless they have root privileges. By using sudo -u a user with the correct set-up in the sudoers file may assume the identity of the low priority user and kill the process. For example: %...


23

As uther mentioned, /usr/local is intended as a prefix for, essentially, software installed by the system administrator, while /usr should be used for software installed from the distribution's packages. The idea behind this is to avoid clashes with distributed software (such as rpm and deb packages) and give the admin full reign over the "local" prefix. ...


20

The Bluetooth protocol stack for Linux checks two capabilities. Capabilities are a not yet common system to manage some privileges. They could be handled by a PAM module or via extended file attributes. (see http://lxr.free-electrons.com/source/net/bluetooth/hci_sock.c#L619) $> sudo apt-get install libcap2-bin installs linux capabilities ...


19

Symlink issue? I had a similar error message when using symbolic links. Apparently systemd doesn't follow symbolic links, the solution is simply to copy or move the file. User service? I believe that you need to add --user to the command line for units in user/: sudo systemctl --user enable arkos-redis.service


17

Version control system is a program like any other. You can install it system-wide or locally if you like. Read the first two lines of GIT installation instructions for example. Also, if you are going to build anything to run as normal user, you might be interested in the question about running your own programs.


17

“Error mounting location: volume doesn't implement mount” apparently translates to “I need D-Bus but it isn't available”. (Thanks to venturax's guru colleague for this information.) Within an SSH session, I can use gvfs-mount provided that dbus-daemon is launched first and the environment variable DBUS_SESSION_BUS_ADDRESS is set. export $(dbus-launch) gvfs-...


17

Use the start-stop-daemon utility to start your daemon. Pass the -c (or --chuid) option to run it as a different user. You'll find some examples in /etc/init.d/*. case $1 in start) echo -n "Starting $DESC: " start-stop-daemon --start --chuid deploy --pidfile "$PID" --start --exec "$DAEMON" -- $DAEMON_OPTS echo "$NAME." ;; …


16

You should be able to get that information from the chage utility. Doesn't require root to run in list mode. Note: this most likely only works for local, passwd-based authentication. I don't know if it can be made to work with authentication modes that don't put login information in the passwd/shadow files. I'm guessing these solutions provide their own ...


16

There are ways to install rpms in a user directory using rpm, but I don't believe it is straight-forward. I don't believe there is a way with yum. My standard practice has become to compile from source to a local directory in my home $ mkdir ~/local $ mkdir ~/local/bin $ mkdir ~/local/lib $ mkdir ~/local/include I download source as I would to /usr/local ...


16

You haven't added any sudo rule, so you can't use sudo for anything. The command adduser USERNAME sudo adds the specified user to the group called sudo. A group with that name must exist; create it with addgroup sudo if it doesn't. After adding the user to the group, the user must log out and back in for the group membership to take effect. sudo is not a ...


16

To reference a few more tools. htop http://hisham.hm/htop/ https://github.com/hishamhm/htop Command line tool, packaged in most distributions, is able to show the I/O without root privileges but only for your processes. run htop(1), you'll find an interface similar to top(1) hit F2 to enter the configuration use ↓ to select "Columns" use → to select "...


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