Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Detailed Linux su command to switch users Mistakes     - Oracle 12c detailing the new features (Database)

- Arduino UNO simulation development environment set up and run simulation (Linux)

- CentOS set up FTP server (Server)

- Install Java JDK 8 in CentOS 7 / 6.5 / 6.4 (Linux)

- Oracle bdump file soaring (Database)

- Comparison of one-time transaction and CTE insert data (Database)

- Java developers question (Programming)

- VPN built on CentOS (Server)

- MySQL 5.6.26 source install (Database)

- Wireless LAN security solutions (Linux)

- Using nmcli commands to manage network in RedHat / CentOS 7.x (Linux)

- Ubuntu 14.04 configure JDK1.8.0_25, switchable version (Linux)

- 14 useful example Linux Sort command (Linux)

- Cacti installation deployment under CentOS 6.6 (Server)

- Network traffic monitoring ntopng (Linux)

- How to find on Linux and delete duplicate files: FSlint (Linux)

- C # and JavaScript arrays to re-summary (Programming)

- Orionode source Linux Mint installation (Linux)

- ElasticSearch - Basic Concepts (Server)

- Proxmox VE implement KVM OpenVZ virtualization cloud computing (Server)

 
         
  Detailed Linux su command to switch users Mistakes
     
  Add Date : 2017-08-31      
         
       
         
  1. Background
For security reasons, the general recommendation is usually in the Linux operating environment for the use of general account

This is because the root account permissions too large, often because of careless misuse cause system errors, but also cause serious system failures, crashes.

Therefore it recommends related operations only when you need to switch to the root account under.

su command to switch users operating under Linux environment

2.su instruction
Many friends in the use of the instruction, often using the following form:

Example: Switching from the general account to the root account moonlit

$ Su

So you do what is wrong with it?

We'll be comparing the observed data under the account before and after switching.

[Moonlit @ host ~] $

Execute the following statement before switching to view the environment contains moonlit variables:

$ Env | grep 'moonlit'

The display shows:

USER = moonlit
MAIL = / var / spool / mail / moonlit
PATH = / usr / java / jdk1.7.0_60 / bin: /usr/lib64/qt-3.3/bin: / usr / local / bin: / bin: / usr / bin: / usr / local / sbin: / usr / sbin: / sbin: / home / moonlit / bin
PWD = / home / moonlit
HOME = / home / moonlit
LOGNAME = moonlit

Performs switching:

$ Su

Password:

After entering the password screen converted to:

[Root @ host ~] #

Enter #pwd view the current path

/ Home / moonlit

Hey, how or in the moonlit account home directory?

Then enter # env | grep 'moonlit'

Screen output:

USER = moonlit
PATH = / usr / java / jdk1.7.0_60 / bin: /usr/lib64/qt-3.3/bin: / usr / local / bin: / bin: / usr / bin: / usr / local / sbin: / usr / sbin: / sbin: / home / moonlit / bin
MAIL = / var / spool / mail / moonlit
PWD = / home / moonlit
LOGNAME = moonlit

See it? Wooden environment has changed ah.

Because there is no change to the root of the environment, it may cause a lot of root instruction errors or invalid oh.

Want complete conversion to root users can use the following command:

[Moonlit @ host ~] $ su -


After you type the root password into [root @ host ~] #

#pwd about:

/ Root


Then # env | grep 'moonlit' look:

Oh, God, no horse.

# Env about:

This time the screen will display all the variables out more, do not list them, you can see the current home directory, PATH, MAIL, etc. have all but replaced the root variables.

Finally, you can release #exit to exit the current root user returns moonlit.

3. Summary
In fact, no - when the system is in accordance with the non-login shell way switch users,

And plus - when the system is switched in accordance login shell.
     
         
       
         
  More:      
 
- 4 lvcreate example commonly used commands (Linux)
- Configuring xdebug debugging environment in Ubuntu 14.04 under the PhpStorm (Linux)
- Production Environment MongoDB Fragmentation and Cluster Solution (Database)
- LVM mirrored logical volume to achieve (Linux)
- Hibernate + JUnit test entity class generate database table (Programming)
- Linux program analysis tool: ldd and nm (Linux)
- Oracle 11g contraction table space error ORA-03297: file contains used data beyondrequested RESIZE value (Database)
- Linux uses a screen recording under RecordMyDesktop (Linux)
- These days have been tossing in the Linux under the ASP.NET 5, on the next in the other operating systems in the ASP.NET 5 or. NET applications, in order to complete the MS VM (CoreCLR) run is not far Reach, the effect of the application.

Cur
(Server)
- Linux deploy Tutorial (Linux)
- Ubuntu install video conversion tool Selene (Linux)
- C ++ thread creates transmission parameters are changed (Programming)
- Linux use logs to troubleshoot (Linux)
- Https (SSL / TLS) Detailed principles (Server)
- Hadoop virtualization performance comparison and tuning experience (Server)
- Ubuntu users how to install the latest Nvidia graphics drivers (Linux)
- Linux SVN account password to save your settings (Linux)
- Linux source code analysis tool (Linux)
- grep command Series: How to Use the grep command in Linux / UNIX (Linux)
- Git remote repository Explanation (Linux)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.