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

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Google DeepMind News
Google DeepMind News
Martin Fowler
Martin Fowler
罗磊的独立博客
The GitHub Blog
The GitHub Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Google DeepMind News
Google DeepMind News
Engineering at Meta
Engineering at Meta
P
Proofpoint News Feed
J
Java Code Geeks
小众软件
小众软件
Y
Y Combinator Blog
M
MIT News - Artificial intelligence
A
About on SuperTechFans
Last Week in AI
Last Week in AI
Jina AI
Jina AI
云风的 BLOG
云风的 BLOG
阮一峰的网络日志
阮一峰的网络日志
D
DataBreaches.Net
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Project Zero
Project Zero
美团技术团队
I
Intezer
Vercel News
Vercel News
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
N
Netflix TechBlog - Medium
F
Fortinet All Blogs
T
Threatpost
P
Privacy International News Feed
Latest news
Latest news
K
Kaspersky official blog
博客园 - 聂微东
月光博客
月光博客
P
Palo Alto Networks Blog
T
The Exploit Database - CXSecurity.com
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
D
Docker
Cisco Talos Blog
Cisco Talos Blog
P
Privacy & Cybersecurity Law Blog
L
LINUX DO - 热门话题
Blog — PlanetScale
Blog — PlanetScale
Security Latest
Security Latest
Know Your Adversary
Know Your Adversary
Recent Announcements
Recent Announcements
T
Tenable Blog
B
Blog RSS Feed
Recorded Future
Recorded Future
雷峰网
雷峰网
SecWiki News
SecWiki News

博客园 - 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没有内置日志功能。‌‌