New answers tagged

0

Assuming you are meaning groups a user is member (which affect what the user could do in a system), you can use the following comand: id username


2

You can fool tar into treating the files as if they have a different owner with fakeroot. Fakeroot runs a command in an environment were it appears to have root privileges for file manipulation, by setting LD_PRELOAD to a library with alternative versions of getuid(), stat(), etc. This is useful for allowing users to create archives (tar, ar, .deb .rpm ...


3

Any existing tarballs can be sanitized via something like: #!/usr/bin/env perl use strict; use warnings; use Archive::Tar 1.80; for my $tarfile (@ARGV) { my $tar = Archive::Tar->new($tarfile) // die "failed to read '$tarfile'\n"; for my $archivefile ($tar->list_files) { $tar->chown($archivefile, 'root:root'); } my ...


2

Generally .tar.gz is a usable file distribution format. GNU tar allows you to replace owner, group and permissions with other values when adding files to the archive. $ tar -c -f archive.tar --owner=0 --group=0 . https://www.gnu.org/software/tar/manual/html_section/tar_33.html#SEC69 If your version of tar does not support the GNU options you can copy ...


0

You're looking for something like tar --owner=0 --group=0 to set everything owned by root/root.


2

With GNU you can use --numeric-owner to prevent tar from storing your username. Alternatively, you can set another userid with --owner=ID. When it's extracted, those user ids will be dropped, unless the extractor is the root user. A common way used to bundle files is cpio which is typically used with the --no-preserve-owner option. This is how rpm files ...


0

sudo -iu <your_username> for me do the trick


2

If you run a similar command to yours: $ cut -d: -f1,6,7 /etc/passwd root:/root:/bin/bash bin:/bin:/sbin/nologin daemon:/sbin:/sbin/nologin adm:/var/adm:/sbin/nologin lp:/var/spool/lpd:/sbin/nologin sync:/sbin:/bin/sync shutdown:/sbin:/sbin/shutdown halt:/sbin:/sbin/halt mail:/var/spool/mail:/sbin/nologin operator:/root:/sbin/nologin ...


1

Your database contents, customized scripts, and configurations should be your top priority. A full system backup is always a good idea to make sure you're not forgetting any important stuff, or to do a quick recovery.


0

You would probably have to look at the source for useradd to find out if it was even possible to specify no password. The "easy" way to do what you want is to use vipw to edit the password file, possibly to add the user manually, or possibly after having used useradd to do the initial record entry, and all you have to do is delete everything in the password ...


3

It is not just being logged in as the olduser, but also if the olduser id is running any processes on the system. If you search the output of ps -ef|grep olduser you may see the processes it is running. Actually, the error message is telling you the PID of the process it is running (the <number> in your question headline) You can kill the process or ...


0

Having users without passwords is just a bad idea. Please assign passwords to all your users, especially "root". Every time you create a user without a password, a kitten dies. On many systems, a good password is often the first, the last and the only line of defense against the scum of the Internet. Please tell me you haven't done that on a machine ...


3

The general sense of @rui-f-ribeiro remark is correct, but the details are not. Details matter. Ubuntu uses these packages: iputils-ping passwd The ping utility resets permissions in a function named limit_capabilities, shared by ping and ping6. The relevant chunk of code looks like this: if (prctl(PR_SET_KEEPCAPS, 1) < 0) { ...


6

As @schily says, in the ping utilility (and others), the root permissions are dropped after they are no longer necessary. This is done for security reasons. From ping.c - main() - the user is dropped with the getuid and setuid call. getuid() gets the current user, and root doing a setuid() will change the uid of the process. /* * Pull this stuff up front ...


2

Based on the clarification, I'm quite certain you use the words user and process incorrectly. It looks to me that you believe something is either a user, or a process (exactly one of them). This is absolutely not the case. Every running instance of an executable program code (no matter if it's started "automatically" (e.g. as part of the boot process) or ...


1

Processes are running instances of executable binaries. Each process, similarly to each file etc., belongs to a certain user. (It's a bit more complicated because there are various user IDs for a process, but most of the time they are the same.) A terminal line (tty) can be opened by any process at any time, just as a process can open/create a file, a TCP ...


3

The uid of the second process has been reset already because there is no need to be root anymore after the sockets have been opened. The passwd utility still needs root privileges when you checked. If you like to verify this, you will need to check the source-code as the reset of the uid may be done too fast to give others a chance to verify the uid before ...


6

Archive::Tar or similar software would be one method. % touch foo % tar cvf x foo foo % tar tvf x -rw-rw-r-- 1 jdoe12 jdoe12 0 May 6 20:36 foo % perl -MArchive::Tar -e '$t=Archive::Tar->new;$t->read("x");$t->chown("foo","root");$t->write("y")' % tar tvf y -rw-rw-r-- 1 root jdoe12 0 May 6 20:36 foo %


3

You cannot change permissions explicitly on extraction, but you can put the preferred identities into the tarball on creation (even when not running as root). tar cvf /tmp/tarball.tar --user=naftuli --group=othergroup files... If the source system doesn't know your account details you can suffix the names with the preferred uid and gid (e.g. ...


0

id | awk '{print $1}' | sed 's:.*(::;s:)$::'


1

Any program can allocate a pseudo-terminal, it doesn't have to involve a login. It's just another form of inter-process communication, which is useful if the application needs to emulate a terminal. An example is the Expect program. It allocates a pseudo-terminal when it spawns a program, so that the program will act as if it's being run interactively by a ...


0

I've been using the form username ALL=(ALL) NOPASSWD: /bin/su targetuser


1

Where we would get, if every new user would be able to sudo by default? This is administrator privilege. Ubuntu is using group sudo to give users this privilege. If you want to allow user to run sudo for everything, add him to the sudo group: useradd -G sudo user1 If you want to limit the user more, you should check how sudoers file look like and adjust ...


0

Yet another route is to launch a new shell as a different (non-root) user to run commands as that user. ubuntu@aws-ip:~$ sudo -u mongodb bash #<-- or zsh, etc... mongodb@aws-ip:~$ mongod --configsvr --dbpath /data/configdb --fork An example of this is the mongodb user. When deploying a sharded MongoDB cluster, all the necessary processes ...



Top 50 recent answers are included