Ubuntu Add new users and add Administrator privileges

Source: Internet
Author: User
Tags uuid

Ubuntu create new users and increase administrator privileges Family2014-06-24 22:21:22$ is an ordinary administrator, #是系统管理员, under Ubuntu, the root user does not have a password by default and therefore cannot be used (supposedly for security). If you want to use root, you have to set a password for the root user:

$ sudo passwd root
Then login to enter the user name root, and then enter the password on the line.
Ubuntu build users best with AddUser, although AddUser and Useradd are the same in other Linux systems, but I use useradd under Ubuntu, and did not create the same name as the user home directory.
Example: AddUser user1
This will automatically create the user home directory and create a group with the same name as the user.
[Email protected]:~# sudo adduser db
[sudo] password for XX:
Enter the password of XX user, the following information appears
Adding user "db" ...
Adding new group "DB" (1006) ...
Adding new user "db" (1006) to group "db" ...
Create home directory "/home/db" ...
Copying files from "/etc/skel" ...
Enter a new UNIX password:
Re-enter the new UNIX password:
Two times the initial password of the input DB, the following information appears
Passwd:password updated successfully
Changing the user information for DB
Enter the new value, or press ENTER for the default
Full Name []:
Number []:
Work Phone []:
Home Phone []:
Other []:
Full Name []: Wait for information to return all the way
Is this information correct? [y/n] Y
To this, the user adds success. If you want this user to have root privileges, execute the command:
[Email protected]:~# sudo vim/etc/sudoers
Modify the file as follows:
# User Privilege Specification
Root all= (All) all
DB all= (All) all
Save exit, the DB user has root privileges.

How to fix Ubuntu 12.04 that the/home partition and swap partition were mistakenly deleted
2012-07-07 09:37:28
When a colleague Debugs a program on Ubuntu, it removes the partition and swap partition that will mount/home and causes her system to fail to log on. Since many updates and development tools are installed on the system, a new system is installed to repeatedly install many packages. The software is installed in the same partition as the root directory, so it is still in the system and avoids a long time to install the update and development tools if it can be repaired. Basically, there are two things to solve: 1. Re-do a mount/home partition (the current mount/directory partition is only 20GB, not enough); 2. Restores the base directory structure of the home directory, including some default user configurations.

First restart the system, with the GParted Live CD (or USB Stick) boot, with the GPARTD partition tool to re-build two partitions, a format for the Ext4 file system, one does not format, marked as swap partition. Remember that the two partitions correspond to the device nodes.

and then restart. Since Ubuntu 12.04 does not support modifying grub's kernel boot parameters at boot time, it cannot go directly into single-user mode, only into Ubuntu recovery mode and select "Drop to Root shell". After entering the root shell, notice that the entire file system is read-only. In this case, to make some changes to the configuration file, the file system must be re-linked to read-write:

Mount-n-O REMOUNT,RW/

Then modify the/etc/fstab file. Now this file uses the UUID to identify the partition, but it still supports past usage--using the device node directly. Remove the previous/home and swap-corresponding UUID entries and replace the new formatted partition's device node, such as/dev/sda5,/dev/sda6. This solves the mount problem of/home. Solve another problem: the user's home directory is empty. Since the contents of the previous home directory have all been lost, and the chances of getting back are very small, it is possible to remove the user and then add the user to re-generate the contents of the user's home directory based on/etc/skel content. Simply say the following:

Userdel-r $FAKE _user
Useradd-n-m-k-u uid $FAKE _user
passwd $FAKE _user

If you are concerned that a file that was previously written by a user cannot be read, you can specify the user uid when you re-add the user. This way, you can have permissions that were previously owned by the user UID.

If you also encounter a problem that cannot be raised by Sudo after a newly generated $fake_user login, you can go back to recovery mode and still remount the file system as read-write and modify the/etc/sudoers file directly:

Root all= (All:all) all
$FAKE _user all= (all:all) all

Or add $fake_user to the admin group:

Usermod-a-G admin $FAKE _user

Reboot and the system is back to normal.

How to restore Ubuntu boot after reloading Win7

After reloading the system, Ubuntu boot on the boot screen is missing and goes directly to the newly installed window system. Here's how to restore the Ubuntu boot method:

1) Prepare an Ubuntu system installation disk;

2) Install the Ubuntu system installation disk into the CD-ROM drive, restart the computer, enter the BIOS, the boot is set to the CD-ROM (cd/rom) boot mode;

3) Then save the settings to exit, wait a moment to enter the Ubuntu installation interface, there are two options

1. Try the Ubuntu system on the CD

2. Install the Ubuntu system on the computer

Select "Try Ubuntu system on this disc" and enter the Ubuntu system to open the terminal (shortcut key combination is ctrl+alt+t);

4) Enter Sudo-i under terminal (Get Administrator privileges)

5) under Terminal input fdisk-l (is lowercase letter ' l ', view disk list characters)

A message similar to the following will appear:

disk/dev/sda:320.1 GB, 320072933376 bytes
255 heads, Sectors/track, 38913 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Disk identifier:0x70f7ab9c

Device Boot Start End Blocks Id System
/DEV/SDA1 1 1627 13060096 Unknown
Partition 1 does not end on cylinder boundary.
/DEV/SDA2 * 1627 1639102400 7 Hpfs/ntfs
Partition 2 does not end on cylinder boundary.
/dev/sda3 1639 8166 52429859 7 Hpfs/ntfs
/DEV/SDA4 8167 38913 246975277+ 5 Extended
/dev/sda5 8167 32385 194539082+ 7 hpfs/ntfs
/dev/sda6 32386 38788 51432066-up Linux
/dev/sda7 38789 38913 1004031, Linux Swap/solaris

Then find the letter ID 83, according to the information shown above, when the fashion Ubuntu is installed in Sda6 this partition.

6) in terminal input mount/dev/sda*/mnt

(* represents the partition on which the Ubuntu system is located, that is, the previous step shows the partition number with ID 83 in the result, as shown above in Sda6 this partition,

So the input is mount/dev/sda6/mnt.

Note: There is a space behind mount, there is a space behind the SDA6, the two spaces must not be missed, otherwise it will be an error.

7) After the previous step is finished, continue entering Grub-install--ROOT-DIRECTORY=/MNT/DEV/SDA in the terminal

Wait for a while, if the Installationfinished,no error reported indicates success

(Note: There is no space between Grub-install,--root Front has a space,--root front is two '-',/mnt behind a space)

8) to this, Ubuntu boot basic recovery, restart the computer, you can see the familiar Ubuntu boot interface, enter the Ubuntu system, open the terminal input

sudo update-grub

Wait a moment to display the following information:

Generating grub.cfg ...
Found Linux Image:/boot/vmlinuz-2.6.31-20-generic
Found initrd Image:/boot/initrd.img-2.6.31-20-generic
Found memtest86+ Image:/boot/memtest86+.bin
Found Windows Vista (loader) on/dev/sda1
Found Windows 7 (loader) on/dev/sda2
Done

The resumption of work was all done.

Ubuntu Add new users and add Administrator privileges

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.