search
HomeSystem TutorialLINUX(shusheng007) Do you know Linux file permissions and chmod command?

From: shusheng007

The article was first published in

Overview

The first time I came into contact with Linux was when I followed the online tutorial to install Tomcat on the server. I always heard the sudo command. I didn’t know what it was, so I just copied and pasted it, and finally the installation was successful. The sad thing is that I logged in with the root account, and I also used sudo?

Knowledge is such a common Linux command. In fact, a problem may seem like a piece of rubbish to veterans, but it is a huge mountain for beginners. Here I will briefly talk about my understanding of this command, which is all regarded as study notes. , in fact, I hope it can help other colleagues in need.

SUDO usage background

The full name of Sudo is: superuserdo. As the name suggests: do what a super user can do! Therefore, the most commonly used function of Sudo is to increase the execution permission of a named name.

As we mentioned in the article Understanding Linux file permissions and chmod commands in seconds, Linux manages permissions by users and groups. If the account you use does not have enough permissions, you will not be able to do some actions, such as restarting the server ( reboot command), what should I do?

Some friends want to fight, isn't the root account good? Do you think that every server is bought by your family? linux restart service command, anyone can use root? Although the main purpose of this command is to solve the problems that exist during the use of root. Root privileges are too great, and leakage or misoperation will lead to huge risks, so sudo was born! Therefore, even if you have root privileges, using this command can avoid irreparable losses or trouble caused by misoperation.

SUDO function

sudo is a Linux system management command. It is a tool that allows system administrators to let ordinary users execute some or all root commands, such as halt, reboot, su, etc. In other words, this command allows non-root users to run commands that only root has permission to execute.

SUDO Principle

Can every newly created user use sudo to increase the command permissions? If not, what user can use this command?

In order for a user to have the ability to use sudo, the root user needs to register his name, specific commands that can be executed, and the identity of which user or user group to execute as, etc. in the /etc/sudoers file. That is, the authorization of the user must be completed (the user is called "sudoer" at this time).

When a normal user executes special permissions, add sudo before the command. At this time, the system will ask you to enter a password to confirm that you are operating in front of the terminal. After confirmation, the system will process the command as a super user. permission to run.

linux重启服务命令_重启linux服务器命令_linux重启所有服务命令

Within a certain period of time, the password will no longer be asked when executing the sudo command again Linux restart service command . After this period of time (usually 5 minutes), you need to enter the password again.

Specific use

It is assumed that the company's services use the Ubuntu18.04 operating system

When the intern girl Niu Cuihua reports for internship at "Perry Tomato Technology" company, the director Wang Ergou needs to create an account for her that can use the sudo command. What should she do?

Step one: Ergou first logs in to the root account and uses the following command to create an account: cuiHuaNiu.

linux重启服务命令_linux重启所有服务命令_重启linux服务器命令

addusercuiHuaNiu

During the creation process, you need to specify the password of the cuiHuaNiu account, as well as other personal information, such as phone number, etc. Ergou can also take the opportunity to get the girl's phone number.

Step 2: Grant cuiHuaNiu administrator rights, that is, register it in the /etc/sudoers file

By default, there is a sudo group on Ubuntu 18.04. Users belonging to this group can use sudo commands, so Ergou only needs to add cuiHuaNiu to the sudo group.

usermod-aGsudocuiHuaNiu

linux重启服务命令_重启linux服务器命令_linux重启所有服务命令

The -a parameter indicates attachment, and is only used with the -G parameter to reduce the user to the group.

Step 3: Niu Cuihua can use cuiHuaNiu to log in to the server, and then use sudo to execute commands that the administrator can execute. In fact, if Cuihua has root permissions, you can also use sudo-i to switch the user identity to root.

ssh

Advantage summary

You can see the Linux server setup here, which means you accidentally learned a common Linux command. Are you angry? It is recommended to like and collect, be a real IT person, willing to share, dare to contribute, help each other...

The above is the detailed content of (shusheng007) Do you know Linux file permissions and chmod command?. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:ITcool. If there is any infringement, please contact admin@php.cn delete
Does the internet run on Linux?Does the internet run on Linux?Apr 14, 2025 am 12:03 AM

The Internet does not rely on a single operating system, but Linux plays an important role in it. Linux is widely used in servers and network devices and is popular for its stability, security and scalability.

What are Linux operations?What are Linux operations?Apr 13, 2025 am 12:20 AM

The core of the Linux operating system is its command line interface, which can perform various operations through the command line. 1. File and directory operations use ls, cd, mkdir, rm and other commands to manage files and directories. 2. User and permission management ensures system security and resource allocation through useradd, passwd, chmod and other commands. 3. Process management uses ps, kill and other commands to monitor and control system processes. 4. Network operations include ping, ifconfig, ssh and other commands to configure and manage network connections. 5. System monitoring and maintenance use commands such as top, df, du to understand the system's operating status and resource usage.

Boost Productivity with Custom Command Shortcuts Using Linux AliasesBoost Productivity with Custom Command Shortcuts Using Linux AliasesApr 12, 2025 am 11:43 AM

Introduction Linux is a powerful operating system favored by developers, system administrators, and power users due to its flexibility and efficiency. However, frequently using long and complex commands can be tedious and er

What is Linux actually good for?What is Linux actually good for?Apr 12, 2025 am 12:20 AM

Linux is suitable for servers, development environments, and embedded systems. 1. As a server operating system, Linux is stable and efficient, and is often used to deploy high-concurrency applications. 2. As a development environment, Linux provides efficient command line tools and package management systems to improve development efficiency. 3. In embedded systems, Linux is lightweight and customizable, suitable for environments with limited resources.

Essential Tools and Frameworks for Mastering Ethical Hacking on LinuxEssential Tools and Frameworks for Mastering Ethical Hacking on LinuxApr 11, 2025 am 09:11 AM

Introduction: Securing the Digital Frontier with Linux-Based Ethical Hacking In our increasingly interconnected world, cybersecurity is paramount. Ethical hacking and penetration testing are vital for proactively identifying and mitigating vulnerabi

How to learn Linux basics?How to learn Linux basics?Apr 10, 2025 am 09:32 AM

The methods for basic Linux learning from scratch include: 1. Understand the file system and command line interface, 2. Master basic commands such as ls, cd, mkdir, 3. Learn file operations, such as creating and editing files, 4. Explore advanced usage such as pipelines and grep commands, 5. Master debugging skills and performance optimization, 6. Continuously improve skills through practice and exploration.

What is the most use of Linux?What is the most use of Linux?Apr 09, 2025 am 12:02 AM

Linux is widely used in servers, embedded systems and desktop environments. 1) In the server field, Linux has become an ideal choice for hosting websites, databases and applications due to its stability and security. 2) In embedded systems, Linux is popular for its high customization and efficiency. 3) In the desktop environment, Linux provides a variety of desktop environments to meet the needs of different users.

What are the disadvantages of Linux?What are the disadvantages of Linux?Apr 08, 2025 am 12:01 AM

The disadvantages of Linux include user experience, software compatibility, hardware support, and learning curve. 1. The user experience is not as friendly as Windows or macOS, and it relies on the command line interface. 2. The software compatibility is not as good as other systems and lacks native versions of many commercial software. 3. Hardware support is not as comprehensive as Windows, and drivers may be compiled manually. 4. The learning curve is steep, and mastering command line operations requires time and patience.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.