Openwrt 串口多用户访问

参考:http://wiki.openwrt.org/doc/howto/secure.access

一、编译配置
1、make menuconfig

Administration --->
   <*> sudo ... ...

Utilities --->
   <*> shadow-groupadd ... ...
   <*> shadow-useradd ... ...
   <*> shadow-usermod ... ...

二、添加用户

useradd win
passwd win
mkdir -p /home/win

vim /etc/passwd
win:x:1000:1000::/home/win:/bin/ash

三、赋予root权限三种方法

①全面开放root权限
visudo

## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
Defaults targetpw  # Ask for the password of the target user
ALL ALL=(ALL) ALL  # WARNING: only use this together with 'Defaults targetpw'

②给win加上root特权
visudo

##                                                               
## User privilege specification
##                                                                      
root ALL=(ALL) ALL                                                      
win ALL=(ALL) ALL    //添加此行

③创建sudo组
visudo

## Uncomment to allow members of group sudo to execute any command
%sudo   ALL=(ALL) ALL

添加sudo 组
groupadd --system sudo
将win加入sudo 组
usermod -a -G sudo win

四、测试


可以使用sudo vi  /etc/config/wireless这样的方式执行root权限,此时输入root密码。

你可能感兴趣的:(OpenWrt)