Linux 用户不在 sudoers 文件中。此事件将被报告。上限部署:设置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18623440/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
user is not in the sudoers file. This incident will be reported. cap deploy:setup
提问by Jngai1297
Newest UpdateThe flag is -p portnumber
but I can't get into root, got (publickey, permission denied)
最新更新标志是 -p portnumber 但我无法进入 root,得到(publickey, permission denied)
I sign up for a vps on digital ocean.
我在数字海洋上注册了一个 vps。
Currently going through this tutorial https://coderwall.com/p/yz8chaand this railscast http://railscasts.com/episodes/335-deploying-to-a-vps
目前正在阅读本教程https://coderwall.com/p/yz8cha和这个 railscast http://railscasts.com/episodes/335-deploying-to-a-vps
I made a new user inside the vps but this user doesn't have sudo priveledge
我在 vps 中创建了一个新用户,但该用户没有 sudo 权限
when I do cap deploy:setup according to the guide I am getting this
当我根据指南进行 cap deploy:setup 时,我得到了这个
judy is not in the sudoers file. This incident will be reported.
failed: "sh -c 'sudo -p '\''sudo password: '\'' ln -nfs /home/judy/apps/lintong/current/config/nginx.conf /etc/nginx/sites-enabled/lintong'" on 192.241.241.204
I changed the port to 888 according to the guide and now I can't ssh into the server
我根据指南将端口更改为 888,现在我无法通过 ssh 进入服务器
when I do ssh root@ipaddress
or ssh judy@ipaddress
当我做ssh root@ipaddress
或ssh judy@ipaddress
its trying to connect to port 22
它试图连接到 port 22
1st question how do I pass in a field to when I ssh into the vps with a port option of 888?
第一个问题,当我使用 888 端口选项通过 ssh 进入 vps 时,如何将字段传递给?
2nd question How do I give judy sudo rights? according to coderwall's tutorial I should do this
第二个问题我如何给 judy sudo 权限?根据 coderwall 的教程,我应该这样做
visudo
then
然后
add username ALL=(ALL:ALL) ALL
but I think I did it before and it didn't work?
添加username ALL=(ALL:ALL) ALL
但我想我以前做过但没有用?
回答by Floris
Answering just one question:
只回答一个问题:
ssh -p 888 root@ipaddress
should allow you to log in when ssh is listening on port 888
. Not sure what is wrong with the second part... can you show the judy
entry from /etc/sudoers
?
应该允许您在 ssh 侦听端口时登录888
。不知道第二部分有什么问题......你能显示judy
来自的条目/etc/sudoers
吗?
回答by Doug Morrow
For ssh to a different port:
对于到不同端口的 ssh:
ssh -p 888 root@ipaddress
To get judy sudo permission somewhat depends on the OS for proper practice. In Ubuntu you can simply add judy to the admingroup.
获得 judy sudo 权限在某种程度上取决于操作系统的正确练习。在 Ubuntu 中,您可以简单地将 judy 添加到admin组。
useradd -G admin judy
This is because there's already an entry that maps that group in the sudoers file for Ubuntu servers.
这是因为已经有一个条目可以在 Ubuntu 服务器的 sudoers 文件中映射该组。
回答by belacqua
For recent Ubuntu/Debian versions, don't modify /etc/sudoers
,
but add the user to to the sudo
group in /etc/group
.
对于最近的Ubuntu / Debian的版本,不要修改/etc/sudoers
,而是将用户添加到该sudo
组/etc/group
。
sudo usermod -a -G sudo judy
sudo usermod -a -G sudo judy
or
或者
sudo vigr
(and sudo vigr -s
)
sudo vigr
(和sudo vigr -s
)
To use ssh with a specific port, use -p 888
: i.e., ssh -p 888 judy@ipaddress
要在特定端口上使用 ssh,请使用-p 888
:ssh -p 888 judy@ipaddress
(Note that if you ever need to set a port with scp, you use a capital -P
instead.)
(请注意,如果您需要使用 scp 设置端口,请改用大写-P
字母。)