1

I have a user named lap that was set up during install of a service named lap. I have to be logged in as user lap to execute certain functions and to access some directories. I do not have the root password. I tried:

$ su - lap
Password: "MyPassWord"
su: Authentication failure

In this case the password I tried is the password of the current user I was logged in as. Which is the same password I would supply for sudo. Also i tried:

$ sudo su - lap
Sorry, user xxxxxgrp is not allowed to execute '/bin/su - lap' as root on myServerName.

In /etc/passwd

lap:x:1003:1004::/opt/lap:/bin/csh

In /etc/shadow

lap:!!:17674:0:99999:7:::

Is there a way I can change to user lap?

1
  • sudo -i -u lap
    – jw013
    Commented Jun 18, 2018 at 17:33

3 Answers 3

1

Only a privileged user (mainly root) can do that or elsewhere can grant you permissions to run things as 'lap' user without password using 'sudo' for specific tasks.

0

The easiest way to get in as root using sudo would be:

sudo - su

entering your sudo password to log in as root. (By the way, most distros don't assign a default root password on setup).

Once you are in as root, it is as easy as assigning a password to lap by doing:

passwd lap

which should allow you to create a new password for that user regardless of what the old one might have been.

However, if you don't have access to an account with sudo privileges, you can always boot into the machine in single-user mode. The method of booting in with single-user mode will vary depending on which distribution you are currently running.

This should take you directly to a root shell where you can then change the password for lap as described above, allowing you full access to that account.

0

it looks like the user you are trying to access the 'lap' user from does not have enough privileges to run the su command. Other options to change the password via sudo could be sudo -u lap passwd

Also other commands can be run as lap using sudo

sudo -u [user] [command]

If you are trying to regain access to the user 'root' add the parameter init=/bin/sh to the kernel parameters at startup

If you are using GRUB

  1. press 'e' while in the menu

  2. add init=/bin/sh (kernel [...] init=/bin/sh)

  3. mount / -o remount,rw to remount filesystem as read-write

  4. passwd to change the 'root' password

  5. exec /sbin/init to start system

Once you regain access to the system via 'root' I suggest you check the /etc/sudoers configuration

check if this line is there

%wheel ALL=(ALL) ALL

this allows all grub wheel users to run all programs I

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .