freebsd sudo配置使用

首先第一步当然是安装sudo


安装好了之后会产生一个sudoers文件

如果你的sudo安装在/usr/bin/sudo下面的话,sudoers文件可能就在/etc/下面

如果你的sudo安装在/usr/local/bin/sudo下面,sudoers文件在/usr/local/etc/下面


把sudo配置成所有的wheel组可以使用


# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
# Failure to use 'visudo' may result in syntax or file permission errors
# that prevent sudo from running.
#
# See the sudoers man page for the details on how to write a sudoers file.
#


# Host alias specification


# User alias specification


# Cmnd alias specification


# Defaults specification
# Uncomment if needed to preserve environmental variables related to the
# FreeBSD pkg_* utilities and fetch.
#Defaults       env_keep += "PKG_PATH PKG_DBDIR PKG_TMPDIR TMPDIR PACKAGEROOT PACKAGESITE PKGDIR FTP_PASSIVE_MODE"


# Additionally uncomment if needed to preserve environmental variables
# related to portupgrade.
#Defaults       env_keep += "PORTSDIR PORTS_INDEX PORTS_DBDIR PACKAGES PKGTOOLS_CONF"


# Runas alias specification


# User privilege specification
root    ALL=(ALL) ALL


# Uncomment to allow people in group wheel to run all commands
# %wheel        ALL=(ALL) ALL


# Same thing without a password
%wheel  ALL=(ALL) NOPASSWD: ALL


# Samples
# %users  ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users  localhost=/sbin/shutdown -h now

另外,如果想把一个组也能用sudo,需要修改 /etc/group ,把wheel那行进行修改:

e.g:

wheel:*:0:root,lxh,lixh

这样归属lxh,lixh组的都可以使用sudo了



  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值