Tag Info

Hot answers tagged

22

The functionality you are looking for seems to be implemented in glibc. You can define a custom hosts file using the HOSTALIASES environment variable. Here is a modified example from http://blog.tremily.us/posts/HOSTALIASES/ that works on my system (Ubuntu 13.10): $ echo 'g www.google.com' >> ~/.hosts $ export HOSTALIASES=~/.hosts $ wget g -O ...


8

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). ...


8

fdisk -l can just list the filesystems it has the permission to read on. See my test with strace: user@host:~/test$ strace -e open /sbin/fdisk -l ... open("/proc/partitions", O_RDONLY) = 3 open("/dev/sda", O_RDONLY) = -1 EACCES (Permission denied) open("/dev/sda1", O_RDONLY) = -1 EACCES (Permission denied) open("/dev/sda2", ...


8

This is possible for syslinux: syslinux ~/floppy.ima The syslinux installer contains enough magic to be run on an unmounted filesystem. (In fact, it is designed to do that.) The extlinux installer expects to be run on a mounted filesystem, though. It is almost certainly possible to split off the extlinux installer into a part that copies the files ...


8

The sudoers file allows specifying commands to permit: username ALL=(root) NOPASSWD: /bin/foo bar baz Here username is the user you want to permit, and the command goes at the end of the line. If you specify arguments to the command, the user can only run it with exactly those arguments, but if you don't specify them here, the user can run the command ...


7

The pam_limits.so module can help you there. It allows you to set certain limits on specific individual users and groups or wildcards or ranges of users and groups. The limits you can set are typically ulimit settings but also on the number of concurrent login sessions, processes, CPU time, default priority and maximum priority (renice). Check the ...


7

@chaos and @Braiam have provided good answers on why you aren't getting the behavior you are looking for from fdisk when running as a non-root user. The simple fact is that allowing regular users to read disks directly would allow bypassing file permissions by simply reading the disk data directly, which could be a major problem and certainly would make file ...


5

If your objective is to find out the device name of the external drive you just connected, the easiest ways is to run dmesg | tail -20 or so right after connecting it: $ dmesg | tail -20 [ 5610.869053] usb 2-1.4: New USB device strings: Mfr=10, Product=11, SerialNumber=5 [ 5610.869058] usb 2-1.4: Product: Iomega Select HDD [ 5610.869062] usb 2-1.4: ...


5

You have basically three options: Use a wrapper around your libraries, that will set LD_LIBRARY_PATH appropriately and then execute the desired library - something like: #!/bin/sh export LD_LIBRARY_PATH="path/goes/here" exec "$@" link with -rpath (-Wl,rpath) which adds search path for dynamic linker into the binary (see also SO answer - it also mentions ...


5

If you add a line in /etc/fstab saying something like: /dev/loop0 /mnt ext4 defaults,user 0 0 you can then mount/unmount /dev/loop0 as a regular user. And if you do chown youruser:youruser <MOUNTPOINT> <LOOPDEVICE> then extlinux , losetup, mkfs, etc can be done as youruser.


4

Can you compile and install a newer version without root? Yes. Can you install it in place of the old one? No. It used to be fairly common for normal users to have bin directories in their home directories. It's become less common now that everyone can have their own Linux/UNIX box on their desk. When you used configure you could change the prefix so ...


4

sudo does not have a built-in way to do this. The basic approach is to write some helper program that makes various checks (does user X own this directory? Is it in the expected path? Are the permission bits sane? Etc.) and then does the chown. You then allow user X to run the helper, as root, via either sudo or filesystem permissions (make the helper suid ...


4

You need to have the program bind to the port while running as root, and then switch to your unprivileged user. tcpsvd offers the -u option for doing this: -u user[:group] drop permissions. Switch user ID to user’s UID, and group ID to user’s primary GID after creating and binding to the socket. If user is followed by a ...


4

This is because super user or root has complete permissions to probe all devices while the users doesn't have such privileges by default. Whenever it tries it fails hence not listing the details. Some groups may have such privilege too which you can add yourself.


4

There are a few ways to output the user ID (UID) with ps; a simple one is with -f: ps -fC X Will give you information for all the X servers that are running (there can be more than one). This presumes that the executable is called X -- if there's no such process, you will have to target something else. Since it almost certainly at least has capital X in ...


4

The easiest way to do this is to install R from source: $ wget http://cran.rstudio.com/src/base/R-3/R-3.1.1.tar.gz $ tar xvf R-3.1.1.tar.gz $ cd R-3.1.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 ...


4

Install your favorite shell on the remote machine. You don't need any administrator privileges to do that, you can install programs in your home directory, it's just less convenient. See Installation on debian 5 32-bit without being a root, How to install program locally without sudo privileges?, Keeping track of programs and other questions. If you want to ...


3

First, you need some configs for ssh server and ssh client. In Server, in /etc/ssh/sshd_config, make sure you accept TZ variable: AcceptEnv LANG LC_* TZ In Client, in /etc/ssh/ssh_config or ~/.ssh/config, make sure you send TZ variable: SendEnv TZ (The defaults are usually to send none from the client, and accept none on the server.) Then make alias ...


3

Use the TZ environment variable. E.g.: bash$ export TZ=US/Pacific bash$ date Mon Mar 3 00:31:17 PST 2014 bash$ export TZ=US/Eastern bash$ date Mon Mar 3 03:33:06 EST 2014 The possible values for TZ are in the directory /usr/share/zoneinfo (see, for example, the existence of /usr/share/zoneinfo/US/Pacific)


3

As variant - create a script (added to crontab) and allow to execute without password http://askubuntu.com/questions/155791/how-do-i-sudo-a-command-in-a-script-without-being-asked-for-a-password


3

What may have happened is: sudo is caching your password. So, after you've correctly completed the implementation of sudo on your system, you have to enter the password for the first command, and after that it's cached for some time. If that happens and you run the sequence sudo aptitude install sendmail sudo apt-get install sendmail Then you'll have to ...


3

Your question is something of an oxymoron - you start by stating that root is required to mount filesystems then ask how filesystems can be mounted without root access. Yes, it's completely possible - and because this is a Unix type system there's lots of different ways to do it. You could use sudo to allow the user to run a specific script as root which ...


3

You can do it, but you need to modify the entry in /etc/fstab corresponding to the filesystem you want to mount, adding the flag user to this entry. Non-privilege users would then be able to mount it. See man mount for more details.


3

Make sure the home directories for the users are accessible early (before cron starts) and have them make an entry in crontab: @reboot /home/username/bin/start_at_boot This is a feature of Vixie cron which should be on your Debian system. The start_at_boot script can start the users daemons directly, or start some tool that manages and watches the users' ...


3

This is what worked for me: USER_NAME=$(printf '%s' "${SUDO_USER:-$USER}") sudo -u $USER_NAME <command-to-exec-in-nonroot-context>


3

You can also use the wrapper application Renv. excerpt Simple R Version Management: Renv Renv lets you easily switch between multiple versions of R. It's simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well. Renv does… Let you change the global R version on a per-user basis. Provide ...


3

If you need to do something that requires root privileges, you need to use some method of gaining root privileges, which on most modern systems means su, sudo, or a wrapper around one of these. What's dangerous about running commands as root (whether it's with su or sudo) is that it gives you a lot more ways to damage your system. So you should only run a ...


3

Simple answer: No, you cannot use on a remote box a program that is not installed on the remote box. Workaround: You do not need admin privileges to install a shell on the remote system. You can install it in your home directory but probably you have to compile it from the sources. Typically using something like configure --prefix=${HOME}/local Last note: ...


2

You can configure sudo to allow a set of users to run the mount command. Update: as to how you can damage a system by mounting? For example, you can create a setuid root shell on a filesystem which you can then mount and execute to get root privileges.


2

screen or tmux Sure you can start processes and have then run continuously by making use of a terminal multiplexer such as screen or tmux. Processes can continue to persist in a screen or tmux session, and you can connect/disconnect to either (screen or tmux) as needed. backgrounding You can run any process you like and then background it and then ...



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