Labels

Friday, 30 June 2017

[Ubuntu] Login as root user

In this article, I will show you how to login as root after installing Ubuntu system.

By default the root user on Ubuntu doesn't have password, so to login as root you must set password for it using this command:

sudo passwd root

The system will ask you to input your current login user password, after that you could set the password for root.

Now, you want to login as root, just type command:

su root


Notice: The bash symbol in terminal for normal user will be the symbol $ and after logging in as root it will become #

For instance:
approved user: approved@approved-X556UAM:~$
root user        : approved-X556UAM:/home/approved#


 
Good luck.

Source: https://askubuntu.com/questions/91598/how-do-i-login-as-root

Sunday, 11 June 2017

[Linux] How to assign directory to user group

A week ago, I created a directory by terminal as user root.
Today I logged in as normal user and opened this directory but it said that I don't have permission.
Here is the way to grant permissions for user to read and write on this directory.

Data in this example:

- Directory name "Programming";
- New user group name "newGroup"
- Current login user name "approved"

Step 1: Login as root
su

Step 2: Create new user group
groupadd newGroup

Step 3: Add current user to newGroup
usermod -a -G newGroup approved

Step 4: List all users of newGroup and make sure it contains approved
grep 'Programming' /etc/group

Step 5:  Make newGroup as a owner of Programming
chown -hR root:newGroup Programming

 Step 6: Grant permission for this group
chmod -R 777 Programming


That's it  ^_^


Source:
https://askubuntu.com/questions/487527/give-specific-user-permission-to-write-to-a-folder-using-w-notation
https://www.cyberciti.biz/faq/howto-linux-add-user-to-group/

[Fedora] Install 7zip on fedora

Open terminal, type command

su
[password of root]
yum install p7zip p7zip-plugins 

There are some useful commands with 7zip:

7z a <archive-filename> <list-of-files>  

7z e <archive-filename> 

7z x <archive-filename> 

7z l <archive-filename> 

7z u <archive-filename> <list-of-files-to-update>

7z d <archive-filename> <list-of-files-to-delete> 

7z t <archive-filename> 

Create archive file:  a

Extract archive file in current directory: e or x

List all files in archive file: l

Update file in archive file: u

Delete file in archive file: d

Test the integrity: t