How do I grant sudo privileges to an existing user? [duplicate]


You need to add the user to the sudo group (which is the “administrators” group in Ubuntu).

If you have already created the user, you can add the user to the sudo group by running the following command in a Terminal.

sudo usermod -a -G sudo hduser

Instead you can try,

sudo adduser hduser sudo

Because In some linux distributions, there is no group called admin in unix. You need to add the user only to the group sudo.

1) Become root. You can do this using sudo -i or becoming root the old fashioned way su -

2) Run visudo

3) I changed this portion of the sudoers file to have my chosen users become sudo users, and you can add users similarly (blank lines introduce to format cleanly):

## User Aliases ## These aren't often necessary, as you can use regular groups ## (ie, from files, LDAP, NIS, etc) in this file - just use %groupname ## rather than USERALIAS # User_Alias ADMINS = jsmith, mikem dbadmin ALL=(ALL) ALL ics ALL=(ALL) ALL ...
0 0

From this article you'll learn how to create a user with root privileges or grant root permissions to an existing user by setting User and Group IDs.

I'll also explain how to delete a user with root privileges (with UID 0 in particular).

Actually it is not a good idea to give all the permissions of root to a non-root user, so use the sudo command on the production servers to run items as superuser, instead of using the methods below.

Warning : Giving a non-root user all the permissions of root is very dangerous, because the non-root user will be able to do literally anything that could cause a big trouble if account is hijacked.

Create a USER Account with ROOT Privileges

Lets say we need to add a new user and grand him root privileges.

Use the following commands to create the new user john, grand him the same privileges as root and set him a password :
# useradd -ou 0 -g 0 john
# passwd john

We've just created the user...

0 0

Users via Command Line 101: Basic User Interaction

Pre-Flight Check

These instructions are intended specifically for adding a user on Ubuntu 14.04 LTS. I’ll be working from a Liquid Web Core Managed Ubuntu 14.04 LTS server, and I’ll be logged in as root.

Step 1: Add the User

It’s just one simple command to add a user. In this case, we’re adding a user called mynewuser:

adduser mynewuser

First you will be prompted to enter the user’s password (twice); do this step. Next you’ll be prompted to enter in the user’s information. This step is not required, and pressing enter fills the field with the default information:

Adding user `mynewuser' ...
Adding new group `mynewuser' (1001) ...
Adding new user `mynewuser' (1001) with group `mynewuser' ...
Creating home directory `/home/mynewuser' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated...

0 0

‘m setting up a new FreeBSD server. I do not want to use a default root user who has full system access. How can I setup and grant sudo privileges to users on a FreeBSD VPS or server?

The root account has full system level access and usually reserved for admin tasks only.

The sudo command allows a very small delegation of power to users other than the root user. This is good tool if you have many users, logging everything the users do with privileges, and you are granting certain privileges. Unless the user is specified, sudo will escalate the privilege to root.

In this quick tutorial I will show you:

How to create a new user on a FreeBSD server. How too add users access to the sudo command. How to delete users from the sudo command.

Install sudo app on a FreeBSD server/vps

Sudo is a program designed to allow a sysadmin to give limited root privileges to users and log root activity. The basic philosophy is to
give as few...

0 0

“root” super user is the ruler of the users in Linux/Unix. Having root access give full and unlimited access to the Linux box. I will demonstrate to permit root access to a user in a Linux system. Regularly root level access used as a part of system administrator.

See Also:

How to Delete a User on Ubuntu System How To Add and Grant Sudo Privileges to Users on Ubuntu System Understanding UMASK value in Linux

This tutorial will help you how to create add new user and provide grant privileges to a new user on an Ubuntu system.

Step #1: Add New User on Ubuntu System

First we add a new user. Run the following command to add new user:

# adduser user_name

Step #2: Grant Root Privileges to the User

By default, new user will only be able to modify files in their own home directory. In order to grant specific user with the root privileges we need to add the user to the sudoers file:

# sudo nano /etc/sudoers Or # sudo visudo ...
0 0

“root” super user is the king of the users in Linux/Unix. Having root access grant full and unlimited access to the Linux box. I will show how to allow root access to a user in a Linux system. Typically root level access used in system administration. It’s always a pain to give others (users) root access. You need to be careful and withdraw the access once need is finished.

According to Linux file system permissions root or super user has full permission read(r), write (w) and execute(x) to any file. By default root user id is 0.

I am going to crate two users namely user1 and user2. Then I will give root access to user1 .

Method : 1 Using Usermod Command

[root@mypc Desktop]# adduser user1
[root@mypc Desktop]# adduser user2
[root@mypc Desktop]# groupadd test

These are the groups I have in my Linux box

[root@mypc /]# groups
root bin daemon sys adm disk wheel

I am going to add user1 to root group


0 0
0 0

If you have used your fresh Ubuntu install for longer than half an hour, chances are that you've discovered the sudo command already.

sudo allows certain users to execute a command under another user's privileges. Most commonly, using sudo implies running a command as a superuser, but the approach works equally well for allowing you to inherit a user ID (uid) and group ID (gid) of any user on the system.

To gain access, a password is asked, and by default it is your password, and not the password of a user you're trying to run a command as. This allows for the system' s administrator to effectively manage user privileges without having any user share their password.

sudo is based off the /etc/sudoers file, which should be edited by root employing the visudo command. WARNING: although /etc/sudoers file is a regular text which root can edit manually, ONLY visudo way of updating it is recommended, as this command, apart from editing capabilities, also does a...

0 0

ok, this comes from my hacker days of trying everything in the system to see what it did.

There is a file /etc/passwd that famously holds passwords (or a marker to signify shadow passwords).

In that file, you will see something like this:

root:!:0:0::/:/usr/bin/ksh daemon:!:1:1::/etc: bin:!:2:2::/bin: sys:!:3:3::/usr/sys: adm:!:4:4::/var/adm: uucp:!:5:5::/usr/lib/uucp: guest:!:100:100::/home/guest: nobody:!:4294967294:4294967294::/: lpd:!:9:4294967294::/: lp:*:11:11::/var/spool/lp:/bin/false invscout:*:200:1::/var/adm/invscout:/usr/bin/ksh nuucp:*:6:5:uucp login user:/var/spool/uucppublic:/usr/sbin/uucp/uucico paul:!:201:1::/home/paul:/usr/bin/ksh jdoe:*:202:1:John Doe:/home/jdoe:/usr/bin/ksh

[example taken from here]

the two sections that are interest to us are the numbers in position 3 and 4. the first one is the user ID, the second is the group. Notice that in this installation (and most installations) the values for root are both 0

If you use...

0 0

The runas command is the closest thing to what you're looking for:

runas /user:username cmd.exe

The format is runas, the username you want to run as, other options, and then the program you want to run.

If you're on a domain, you can use:

runas /user:DOMAIN\USERNAME cmd.exe

This can be run from the Run box ( Win+R ) or from a command window.

Note, however, that this is not exactly like sudo - you can't use it to elevate yourself, just run something as a different user. If you're already have administrative rights, a runas to your account will give you the same access as the regular command (unless, of course, you runas a different administrator account, which will grant those administrator's rights to the new...

0 0

This article has been long due from our side since OwnCloud 8 has been released, the product is pretty stable and popular now with the latest stable release of version 8.1.1

Like previous iterations, keeping in mind the small footprint and power of Raspberry Pi we would be using following components:

Nginx (as Webserver instead of Apache, as it would be faster) MySql Php 5

So without much ado, let get straight into Business...

Step 1.
Update the repositories
sudo apt-get update

Step 2.
Install MySql
sudo apt-get install mysql-server

Enter a password for root account when prompted, and do remember it :)

Step 3.
Let's now configure the mysql so that it runs better on our tiny resource tight Raspberry Pi
Backup existing config
sudo mv /etc/mysql/my.cnf /etc/mysql/my.cnf.bak

Use a suitable config for Raspberry Pi
sudo cp /usr/share/doc/mysql-server-5.5/examples/my-small.cnf...

0 0

While you can't directly recover a MySQL password without bruteforcing, there might be another way - if you've used MySQL Workbench to connect to the database, and have saved the credentials to the "vault", you're golden.

On Windows, the credentials are stored in %APPDATA%\MySQL\Workbench\workbench_user_data.dat - encrypted with CryptProtectData (without any additional entropy). Decrypting is easy peasy:

std::vector decrypt(BYTE *input, size_t length) { DATA_BLOB inblob { length, input }; DATA_BLOB outblob; if (!CryptUnprotectData(&inblob, NULL, NULL, NULL, NULL, CRYPTPROTECT_UI_FORBIDDEN, &outblob)) { throw std::runtime_error("Couldn't decrypt"); } std::vector output(length); memcpy(&output[0], outblob.pbData, outblob.cbData); return output; }

Or you can check out this DonationCoder thread for source + executable of a quick-and-dirty...

0 0
grep 'temporary password' /var/log/mysqld.log Sort date (newest date)

You may see something like this;

[root@SERVER ~]# grep 'temporary password' /var/log/mysqld.log 2016-01-16T18:07:29.688164Z 1 [Note] A temporary password is generated for root@localhost: O,k5.marHfFu 2016-01-22T13:14:17.974391Z 1 [Note] A temporary password is generated for root@localhost: b5nvIu!jh6ql 2016-01-22T15:35:48.496812Z 1 [Note] A temporary password is generated for root@localhost: (B*=T!uWJ7ws 2016-01-22T15:52:21.088610Z 1 [Note] A temporary password is generated for root@localhost: %tJXK7sytMJV 2016-01-22T16:24:41.384205Z 1 [Note] A temporary password is generated for root@localhost: lslQDvgwr3/S 2016-01-22T22:11:24.772275Z 1 [Note] A temporary password is generated for root@localhost: S4u+J,Rce_0t [root@SERVER ~]# mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root: The existing password for the user account root has expired. Please set a new...
0 0

Do not mess with the mysql db. There is a lot more going on there than just the users table. Your best bet is the "SHOW GRANTS FOR" command. I have a lot of CLI maintenance aliases and functions in my .bashrc (actually my .bash_aliases that I source in my .bashrc). This function:

mygrants() { mysql -B -N $@ -e "SELECT DISTINCT CONCAT( 'SHOW GRANTS FOR \'', user, '\'@\'', host, '\';' ) AS query FROM mysql.user" | \ mysql $@ | \ sed 's/\(GRANT .*\)/\1;/;s/^\(Grants for .*\)/## \1 ##/;/##/{x;p;x;}' }

The first mysql command uses SQL to generate valid SQL which is piped to the second mysql command. The output is then piped through sed to add pretty comments.

The $@ in the command will allow you to call it as: mygrants --host=prod-db1 --user=admin --password=secret

You can use your full unix tool kit on this like so:

mygrants --host=prod-db1 --user=admin --password=secret | grep rails_admin | mysql --host=staging-db1 --user=admin --password=secret


0 0

Setting up Email with Postfix, Dovecot, and MySQL

If you're not interested in running your own mail server you can skip this entire section.

For this I used another guide by Linode.

First, make sure you open up the following ports on your router: 143, 993,465, 25 and 587. This in addition to the ports that already should be open: 80, 443 and 22.

Configuring DNS

Add a MX record to your domain provides DNS Manager. For example: MX 10 YOUREXTERNALIPADDRESS

Installing Packages

We'll start by installing all of the necessary packages. Go into your Pi terminal and type:

sudo apt-get install postfix postfix-mysql dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-mysql mysql-server

When prompted, type a new secure password for the root MySQL user. Type the password again. Make sure you remember what it is - you'll need it later.

You'll be prompted to...

0 0