2011年1月14日星期五

USRP2 permission for non-root user

http://gnuradio.org/redmine/projects/gnuradio/wiki/USRP2UserFAQ


Can the USRP2 be used by a non-root user?

The code that talks to the USRP2 uses raw socket access (SOCK_RAW) on the ethernet port. This allows the use of a custom ethertype rather than building on a higher level protocol like IP or UDP. The kernel does not allow anyone but root to use raw sockets. This is unlikely to change any time soon. Other tools that use raw sockets must also be run as root or are suid (like ping).

It is possible to allow suid access to the USRP2 by making usrp2_socket_opener suid root. This allows us to use the least privileges possible on all other programs, and usrp2_socket_opener is a nice short program that can easily be audited. Example:

sudo chmod u+s /usr/local/bin/usrp2_socket_opener

Note that if you do a make install again it may overwrite your usrp2_socket_opener, and then it won't have the permissions set anymore. You can avoid this by putting the suid copy in your ~/bin directory, which won't be overwritten every time.

To enable real-time scheduling for non-root users, edit /etc/security/limits.conf and add this line:
@usrp  - rtprio 50

make sure that your user is a member of group usrp, then logout and back in.

----------------------------------------------------------------------

http://gnuradio.org/redmine/wiki/1/USRP2UserFAQ

http://gnuradio.org/redmine/wiki/1/UdevConfig


Using the command to add "read" and "execuate" permission for all.

sudo chmod a+rx .gr_fftw_wisdom

没有评论:

发表评论