Linux Learning-----User, user group Management network settings SSH service

Source: Internet
Author: User
Tags file transfer protocol pscp

Linux Private Services

Services that do not require users to install software independently, but that can be used directly after our system is installed (built-in)

1. Operating mode (runlevel)

There is a process init (initialize, initialize) in Linux with a process ID of 1.

The process has a corresponding configuration file: Inittab (System Run level profile location/etc/inittab)

"#" represents a comment in the configuration file

7 Levels of Operation:

0-Indicates the level of shutdown (do not set the default run level to 0)

1-Single user mode

2-Multi-user mode without NFS (Network file system)

3-Full multi-user mode

4-mode not in use (retention mode)

5-X11, complete graphical interface mode

6-Indicates the restart level (do not set the default RunLevel to 6)

Init 0 shutdown

Init 3 Multi-user mode with no interface

Init 5 Mode with interface

Init 6 Restart

The above command is a temporary switchover after the restart and restore the Settings command mode is the command line mode (change the init value in the Etc/inittab file to 3 and restart)

User account Management (user account add delete Modify and user password Management user group)

Three files

/ETC/PASSWD key information for storing users

/etc/group Storage User Group key letter

/etc/shadow Store user's password information

1. User Management

    1. Add User: Useradd option user name

Option:-G: Indicates the user's primary group option value for the specified user can be a user group ID or a name

-G: Indicates the user-attached group option value for the specified user can be a user group ID or a name

-u:uid, the user's ID (identifier of the user) the system assigns the UID sequentially from 500 onwards if you do not want to use system assignment to customize the option

Verify that the creation is successful:

    1. Open the last line of the/etc/passwd file to see if there is Zhang San information
    2. Verify that a home directory exists (creates a home directory with the same name when it is created)

2. Modify User: Usermod option user name

Option:-G: Indicates the user's primary group option value for the specified user can be a user group ID or a name

-G: Indicates the user-attached group option value for the specified user can be a user group ID or a name

-u:uid, the user's ID (identifier of the user) is assigned by default from 500

-L: Modify user Name

3. Set the password (Linux does not allow users without a password login system) passwd user name

No input prompts to ensure consistent two output when setting password

4. Switch User command: SU username if user name does not specify meaning switch Super admin

Note: 1. Switching from root to normal user does not require a password and vice versa

2. The working path before and after switching users is constant

3. There is no way for ordinary users to access the root user directory

5. Delete User userdel option user name

Common options:-r: Deletes a user's home directory while deleting it

Question: The user who has logged in is not deleted, how to delete?

Workaround: Kill all the users ' processes before deleting them

Note: All commands that are related to the user have access to the root super administrator except/etc/passwd

2. User group Management:

The user group is created at the same time as the user is created (added delete and modify of user group Add Delete group)

User group name Password user Group ID group user name

Group user name: Indicates that the additional group is the user name of the group

1. User group Add Groupadd option user Group name

Common option-G choose to set your own custom user group ID

2. User group edit Groupmod option user Group name

Common options:-G Choose to set a custom user group ID yourself

-N Sets the name of the user group for the new user group

3. User group deletion Groupdel user group name

Note: If you need to delete a row for a group but the group is a user's primary group, the deletion is not allowed if you must remove all users from the group first

3. Network settings:

Nic configuration file Location/etc/sysconfig/network-scripts

Nic name ifcfg-NIC name

Onboot whether the boot starts

Bootproto IP address Assignment, DHCP represents Dynamic Host Assignment protocol

HWADDR hardware address, MAC address

To restart the NIC Operation service Network restart

Some branch versions may not have service commands to quickly operate the services but there is a common directory:/etc/init.d shortcuts for many services in this directory

The command to restart the NIC can also be used:/etc/init.d/network restart

Extension: If you modify the configuration file of the network card, but the directory hierarchy of the configuration file is very deep at this time you can create a shortcut in a shallow directory (soft connection)

Ln-s Original file path shortcut path

Ln-s/etc/sysconfig/network-scripts/ifcfg-eth0 ~/ifcfg-eth0

The following table can be listed by ls-l

The file type location in is "L" to indicate that its type is link (connection type), followed by an arrow pointing to the original file path

Stop a network card ifdown NIC name

Turn on a network card ifup NIC name

Do not arbitrarily disable the network card in actual work

4.SSH Service (FOCUS)

SSH (Secure shell Protocol) 2 Common functions Remote Connection protocol remote file Transfer Protocol

Protocol using port number: Default 22 (Can be modified to modify the SSH service configuration file/etc/ssh/ssh_config)

Port range 0-65535

You cannot use a port that is already occupied by another server

Service Start/Stop/restart (two methods)

1. Service sshd Start/stop/restart

2./etc/init.d/sshd Start/stop/restart

1. Remote Terminal

Terminal tools mainly help operators connect to remote servers Common tools are: Xshell Putty securecrt

Putty using:

1. Get the terminal address of the server can be viewed through the ifconfig command and then test the connection connectivity of the IP (enter ping IP address on Windows cmd)

2. Open Putty Enter related information IP port number type

3. Click Yes on the pop-up confirmation

4. Enter the user name password

Remote file transfer for SSH

Visual Interface Transfer Tool Filezilla

You can view the icon on the desktop after you install it.

Steps to use:

1. Select File---à site manager--à new site (first name setting)---à

Host: Server IP address

Protocol: SFTP-SSH

Login type: normal---à

If you want to connect and click Connect Now, click OK

2. The effect after a good connection

3. How to upload files from local windows to Linux

Drag files directly can also right-click Upload

4. Download the Linux file to the local

Drag files directly can also right-click Download

Extensions: Transferring files or folders from the command-line tool

Tool: PSCP.Exe (must be opened with cmd command) for ease of use can be put into environment variables (placed in the C:/windows directory)

Usage:

1.PSCP option User name @linux host Address: Resource path Windows Local address (download to win)

2.PSCP option Resource Path user name @linux host address: remote path (uploaded to Linux)

3.PSCP option-LS User name @linux host address (lists the structure under the remote path)

Linux Learning-----User, user group Management network settings SSH service

Related Article

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.