Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
6
rated 0 times [  6] [ 0]  / answers: 1 / hits: 2380  / 2 Years ago, mon, october 3, 2022, 1:16:52

I'm running Ubuntu 13.10 on a late 2013 Macbook Pro Retina (booted via Refind).



My issue is that running iwconfig doesn't output Link Quality or Signal Level unless run as sudo.



me:~$ sudo iwconfig
eth0 IEEE 802.11abg ESSID:"redacted_essid"
Mode:Managed Frequency:2.447 GHz Access Point: RE:DA:CT:ED:XX:XX
Bit Rate=144 Mb/s Tx-Power=200 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=70/70 Signal level=-35 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

lo no wireless extensions.


Not as sudo:



me:~$ iwconfig  
eth0 IEEE 802.11abg ESSID:"redacted_essid"
Mode:Managed Frequency:2.447 GHz Access Point: RE:DA:CT:ED:XX:XX
Retry long limit:7 RTS thr:off Fragment thr:off
Power Management:off

lo no wireless extensions.


Is this normal, and is there something I can do to make it work without super user permissions?



My reason is that the Vicious Wifi Widget for Awesome Window Manager expects to be able to query iwconfig for this information not as root: http://git.sysphere.org/vicious/tree/widgets/wifi.lua



Thanks so much.


More From » wireless

 Answers
0

The command iwconfig is a system administration commands (usually only for root). See man iwconfig. It is documented under section 8 of manpages. To know more about manpages see this post.



If you try in terminal,



$ type iwconfig 
iwconfig is hashed (/sbin/iwconfig)


and /sbin contains privileged executables. This is the reason why you are not able to have its full features when using as non-root user. There is nothing abnormal.



How to use sudo iwconfig without password [source]



You can use the NOPASSWD directive in your /etc/sudoers file.



If your user is called user and your host is called host you could add these lines to /etc/sudoers:



user host = (root) NOPASSWD: /sbin/iwconfig


This will allow the user user to run the command sudo iwconfig on host without entering a password. All other sudoed commands will still require a password.



It is recommended to use sudo visudo to edit the file. Read this nice post before you proceed. There you can find an alternative too if you do not wish to modify your /etc/sudoers






The other bad way [not recommended] is to ask sudo to read your password from a file where  your password is already stored. But this may be severe security concerns. -S switch enables sudo to read a password from standard input.



If you store your password in a file mypsd.txt that contains only your password followed by a new line character. Then the following command will run reading your password from that file,



cat /path/to/mypsd.txt | sudo -S iwconfig

[#27356] Monday, October 3, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
elecerna

Total Points: 140
Total Questions: 121
Total Answers: 107

Location: Northern Ireland
Member since Sun, Nov 21, 2021
3 Years ago
;