惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
Security Archives - TechRepublic
Security Archives - TechRepublic
NISL@THU
NISL@THU
T
The Exploit Database - CXSecurity.com
T
Threat Research - Cisco Blogs
A
Arctic Wolf
C
Cyber Attacks, Cyber Crime and Cyber Security
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
The Blog of Author Tim Ferriss
Simon Willison's Weblog
Simon Willison's Weblog
V
Visual Studio Blog
T
Tenable Blog
J
Java Code Geeks
C
CERT Recently Published Vulnerability Notes
The Register - Security
The Register - Security
The Cloudflare Blog
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
U
Unit 42
宝玉的分享
宝玉的分享
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 司徒正美
Last Week in AI
Last Week in AI
Forbes - Security
Forbes - Security
I
Intezer
云风的 BLOG
云风的 BLOG
雷峰网
雷峰网
Scott Helme
Scott Helme
月光博客
月光博客
Google Online Security Blog
Google Online Security Blog
T
Tailwind CSS Blog
爱范儿
爱范儿
Recent Commits to openclaw:main
Recent Commits to openclaw:main
L
LangChain Blog
S
Securelist
Spread Privacy
Spread Privacy
D
Darknet – Hacking Tools, Hacker News & Cyber Security
酷 壳 – CoolShell
酷 壳 – CoolShell
P
Proofpoint News Feed
C
Cybersecurity and Infrastructure Security Agency CISA
Hugging Face - Blog
Hugging Face - Blog
S
Security Affairs
S
SegmentFault 最新的问题
L
Lohrmann on Cybersecurity
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Tor Project blog
博客园 - 聂微东
H
Heimdal Security Blog
B
Blog
Attack and Defense Labs
Attack and Defense Labs

博客园 - KLAPT

Gateway 网关 CodeX =>Skills Redis 内存满了怎么处理 SpringBoot 默认配置修改 JWT 续签 Access Token + Refresh Token 双 Token claudeCode 命令 MyBatis 的 Mapper 接口 AI | CC GUI 集成 IDEA 完整教程 在IDEA中使用Claude Code IDEA中使用CodeX MyBatisPlus解决大数据量查询慢问题 idea 中的 claude code Token Dubbo 和 Spring Cloud Gateway的区别 Transactional 注解中propagation 掌握 Spring 框架这 10 个扩展点 SpringBoot 快速实现 api 加密 Spring Boot/Cloud 中 bootstrap.yml 与 application.yml SpringBoot 实现 DOCX 转 PDF 微服务Token鉴权设计的几种方案 进程、线程、协程 RSA 加密 Java二维码 ntp服务端和客户端 Chronyd与NTP chronyd 作为服务器时钟 chrony java -cp 和 java -jar Maven 项目打包:实现业务代码与第三方依赖分离 达梦数据库创建用户 梦数据库新增大字段报错问题 达梦数据库操作 MySQL UPDATE多表关联更新 达梦数据库 为HTTP POST请求设置请求体 在Java中调用第三方接口并返回第三方页面 Java调用第三方接口的方法 Nginx 之Rewrite 使用详解 linux 命令 Spring Boot项目中集成Spring Security OAuth2和Apache Shiro
sudo命令和su 的区别
KLAPT · 2026-01-29 · via 博客园 - KLAPT

su(switch user)和sudo(super user do)是Linux系统中用于权限管理的两个关键命令,主要区别在于su用于切换用户身份,而sudo用于以提升的权限执行单个命令。

  • su‌:用于切换用户身份的命令,默认切换到root用户,需要输入目标用户的密码(如root密码)。‌‌
  • sudo‌:允许普通用户以root或其他指定用户的权限运行单个命令,无需完全切换用户,需要输入当前用户的密码。‌‌
  1. ‌密码要求‌:su需要目标用户的密码;sudo需要当前用户的密码。‌‌
  2. 权限范围‌:su切换后获得目标用户的全部权限;sudo可通过/etc/sudoers文件精确控制用户能执行的命令,实现权限最小化。‌‌
  3. 环境变量‌:使用su -会加载目标用户的完整环境(login-shell);sudo默认保留当前用户的环境变量。‌‌
  4. ‌安全性‌:sudo更安全,无需共享root密码,且有操作日志记录;su需要共享root密码,存在安全风险。‌‌ 
  5. ‌使用方式‌:su启动一个新的shell会话,允许长时间以目标用户身份操作;sudo只执行单个命令后立即返回当前用户。‌‌ 
  6. ‌配置与日志‌:sudo通过/etc/sudoers文件配置权限,并记录日志供审计;su没有内置日志功能。‌‌