TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Su VS sudo su VS sudo -u -i

51 点作者 johnkpaul大约 13 年前

10 条评论

ars大约 13 年前
"With no extra arguments, as far as I can tell su &#60;username&#62; is exactly the same as attempting to login remotely as that user,"<p>This is not correct. su does not change the ownership of the pts (tty), so for example you can not run screen after doing that.<p>I actually have no idea how to change to a different user and also setup the pts properly, so I've resorted to telneting to localhost when I need to do that.
评论 #3751714 未加载
lubutu大约 13 年前
su is unnecessary; <i>sudo -s</i> is equivalent to <i>sudo su</i>, but allows the admin to restrict who may sudo to whom, for which programs, and so on.
评论 #3750396 未加载
staunch大约 13 年前
I always do<p><pre><code> $ sudo su - # root $ sudo su - username # user $ man su -, -l, --login make the shell a login shell</code></pre>
stox大约 13 年前
Completely missing the different aspects of logging each different invocation may have.
zobzu大约 13 年前
people still writing stuff and getting upvotes without bothering to RTFM to the slightest.<p>man sudo<p>=&#62; sudo -s<p>hard uh. always read the f. man damnit. you know, that's what RTFM means.
评论 #3750789 未加载
padobson大约 13 年前
I use <i>sudo su - &#60;username&#62;</i> pretty regularly when I'm working on servers. I have a dev box where I do initial deploys of all of my apps, and each app has a different username with different configurations to run/debug the app.<p><i>sudo su - &#60;username&#62;</i> takes me to the homefolder of the user and allows me to switch without remembering the password for all of the different users. If I need to do some system-level operation, I open a new tab and run the superuser there.
评论 #3751139 未加载
mappu大约 13 年前
I'm not a sudoer on any box i administrate, and i've apt-get remove'd it from my personal VPSes. It's a little worrying, occasionally you'll run across a shell script that runs sudo for half it's lines and you're not entirely sure why.<p>Using plain su instead of sudo &#60;command&#62; forces me to enter my password, thereby encouraging a concious decision about whether a command needs to be run as root, and the change in prompt is another reminder to be careful.
评论 #3751131 未加载
评论 #3751612 未加载
评论 #3751128 未加载
评论 #3751062 未加载
mikegirouard大约 13 年前
&#62; The only use that I can see for this is, as a system administrator, debugging issues that are user specific. So far, I have not needed it.<p>I use `sudo -i` daily, but when doing things that would require things to be in root's path (eg `service` on RHEL envs).
moe大约 13 年前
Real men <i>su -</i> and that's it.
squadron大约 13 年前
Forgot vs root.