Tag Info

Hot answers tagged

16

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", ...


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

You can use cron if your version has the @reboot feature. From man 5 crontab: Instead of the first five fields, one of eight special strings may appear: string meaning ------ ------- @reboot Run once, at startup. … You can edit a user-local crontab with the command crontab -e without root privileges. Then add the ...


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


4

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


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

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

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


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


3

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


3

On Linux, you need the CAP_CHOWN capability to chown. root is granted such. Refer to: http://vouters.dyndns.org/tima/Linux-OpenVMS-C-Implementing_chown.html for explanations. If you intend to give the CAP_CHOWN capability, build your code with libcap-ng or libcap as demonstrated by: ...


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

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

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


2

You have several options here: Git commit your .vim folder and have your group members clone it from there. Have each group member symlink their /.vim to a shared folder. Have each user modify their .vimrc to point to a shared folder like this: call pathogen#infect('foobundle/{}', '/foovim/foobundle/{}') The first argument specifies the name of the ...


2

If this is going to accessible via the network, yes. In order for apache to access the public_html it's going to need some level of access to root's home directory (which could be catastrophic if they somehow found a way, via software vulnerability or unsafe configuration, to add something to root's .bash_profile or something). Run as little as humanly ...


2

An .rpm file is actually a form of cpio archive, which is a lot like a simple form of tar. The rpm2cpio utility is probably installed on the system and does not require privileges to use; it writes to standard out, so to convert: rpm2cpio whatever.rpm > whatever.cpio There's a man cpio you can look at yourself, but what you now want to do is feed the ...


2

On modern Unices, only the file owner is allowed to change the file mode. There were some historic Unices that had a feature called "group superuser", but this no longer exists in any modern Unix that I know of. The only way to do this would be to have a setuid program that checks your group memberships, and allows you to chmod if you match the file's ...


2

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


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


2

Using renice without sudo would be impossible. I quote from the renice(1) man page: Users other than the super-user may only alter the priority of processes they own, and can only monotonically increase their ``nice value'' (for security reasons) within the range 0 to PRIO_MAX (20), unless a nice resource limit is set (Linux 2.6.12 ...


2

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)


2

If you are on systemd, it's trivial, because systemd doesn't require the "fork/exec/pidfile" formalism. You just create a service file and systemd takes care of starting the process, restarting a crashed instance and so on. You can also easily allow users to create their own service files (or even run them not as root but as their own user - if that's useful ...


1

Encryption is a red herring here. It only protects against a very small set of threats. The administrator of the cluster can read all your files as soon as you enter the key to decrypt them. Encryption would only protect you against the administrator if you never decrypted the files on the cluster, in which case you could use some offline form of encrypted ...


1

Couple of things: The command sudo is for elevating yourself to a higher level of credentials for either a command or set of commands, not for gaining access to a directory with which you (1) aren't either the owner, (2) in a group that has read permissions to said directory, or (3) the directory doesn't have the other permissions opened to the world. The ...


1

It isn't very difficult to install vim in your home directory, and I see that you've found a way. However this is not necessarily the best solution. Running vim on the remote machine has the downsides of running a remote editor: it lags if the connection lags; it dies if the connection dies. You can use (g)vim locally to edit remote files. There are two ...



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