LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-24-2010, 07:50 AM   #1
10110111
Member
 
Registered: Jun 2008
Location: St.-Petersburg, Russia
Distribution: (B)LFS, Ubuntu, SliTaz
Posts: 403

Rep: Reputation: 51
How to set access permissions on a network interface?


Suppose a command:
Code:
$ ethtool eth5
Settings for eth5:
Cannot get device settings: Operation not permitted
Cannot get wake-on-lan settings: Operation not permitted
        Current message level: 0x000000ff (255)
Cannot get link status: Operation not permitted
which means eth5 is not accessible by normal user. How can i give an ordinary user access to this interface? If eth5 were a file in /dev, i would just change devnode file permissions. But it's not. So, what's the way?
P.S. sudo is not a good solution since it would make the program executed as root while i may not want this.

Last edited by 10110111; 08-24-2010 at 07:52 AM.
 
Old 08-24-2010, 03:22 PM   #2
dr_agon
Member
 
Registered: Sep 2007
Location: Poland
Distribution: Ubuntu LTS
Posts: 105
Blog Entries: 12

Rep: Reputation: 26
Once I used the udev rules for setting permissions for /dev/sda*. It is described in my blog here.
See also
Code:
man 7 udev
I don't know if it will work for eth, it's just a hint.
Good luck.
 
Old 08-24-2010, 04:41 PM   #3
10110111
Member
 
Registered: Jun 2008
Location: St.-Petersburg, Russia
Distribution: (B)LFS, Ubuntu, SliTaz
Posts: 403

Original Poster
Rep: Reputation: 51
You misunderstood me. eth? is not a file in /dev - it's not a file at all, so usual file permissions trick will not help here, which is the very problem i'm trying to solve.
 
Old 08-24-2010, 06:44 PM   #4
kinetic
Member
 
Registered: Aug 2007
Location: Fort Collins, Colorado
Distribution: Gentoo
Posts: 64

Rep: Reputation: 17
Udev governs all devices including network devices and anything that is/isn't in /dev. Take dr_agon's advice and start looking at udev rules. I'm sure you'll find what you're looking for. (and no I don't know how to do what you're asking specifically)
 
Old 08-24-2010, 07:10 PM   #5
Thymox
Senior Member
 
Registered: Apr 2001
Location: Plymouth, England.
Distribution: Mostly Debian based systems
Posts: 4,368

Rep: Reputation: 64
Is the user in question a member of the "netdev" group or equivalent for your system?

--thymox
 
1 members found this post helpful.
Old 08-24-2010, 07:31 PM   #6
10110111
Member
 
Registered: Jun 2008
Location: St.-Petersburg, Russia
Distribution: (B)LFS, Ubuntu, SliTaz
Posts: 403

Original Poster
Rep: Reputation: 51
Quote:
Take dr_agon's advice and start looking at udev rules.
As far as i have currently researched, udev only seems to rename network devices, not manage permissions for them.

Quote:
Is the user in question a member of the "netdev" group or equivalent for your system?
Well... there's no such group on my system (LFS 6.3).
Tried to add the user to this group on Ubuntu, but it didn't give me ethtool eth0 permission.
 
Old 08-24-2010, 07:45 PM   #7
kinetic
Member
 
Registered: Aug 2007
Location: Fort Collins, Colorado
Distribution: Gentoo
Posts: 64

Rep: Reputation: 17
This might be something a kernel developer could answer. I wonder if SELinux or anything related to "security profiles" might hold the answer.
 
Old 08-28-2010, 04:59 PM   #8
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Say if you are using ethtool, try chmod'ing u+x for ethtool. Just a thought?
 
Old 08-28-2010, 05:06 PM   #9
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Or possibly /etc/sysconfig/network-scripts/ifcfg-eth0? I am at work, so I don't have access to any of my unix or linux boxes.
 
Old 08-29-2010, 06:50 AM   #10
10110111
Member
 
Registered: Jun 2008
Location: St.-Petersburg, Russia
Distribution: (B)LFS, Ubuntu, SliTaz
Posts: 403

Original Poster
Rep: Reputation: 51
Quote:
Say if you are using ethtool, try chmod'ing u+x for ethtool. Just a thought?
ethtool is already executable a+x. It just doesn't have the permissions for some ioctls.
Quote:
Or possibly /etc/sysconfig/network-scripts/ifcfg-eth0?
/etc/sysconfig/network-scripts doesn't exist on both Ubuntu & LFS which i use.
 
Old 08-29-2010, 08:35 AM   #11
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
ethtool needs to be run as root.
Why do you want to give an ordinary user access to ethtool ? Perhaps there is an easier way of achieving what you want.
 
Old 08-30-2010, 03:33 AM   #12
10110111
Member
 
Registered: Jun 2008
Location: St.-Petersburg, Russia
Distribution: (B)LFS, Ubuntu, SliTaz
Posts: 403

Original Poster
Rep: Reputation: 51
Quote:
ethtool needs to be run as root.
Why do you want to give an ordinary user access to ethtool ?
Suppose, a use wants to r/w his disk drive (e.g. using dd). But disk drives are only accessible by root. Then you can chmod disk's /dev entry, and the user wouldn't have to use sudo. Additionally, the user would be able to do anything with the disk given away to him, including writing his own program to operate the disk.

That's the same i want to do with the NIC - just give it away to some user(s), so not only ethtool here, but any ioctl which controls the given network interface.
 
Old 08-30-2010, 10:15 AM   #13
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Thanks for the explanation.

If you don't want to use sudo, or give the user full root access, maybe let them run in a virtual machine (where they can have root access, without harming the host machine) and give eth5 to the virtual machine.

Otherwise, maybe socat can help you:
Quote:
Socat is a relay for bidirectional data transfer between two independent data channels. Each of these data channels may be a file, pipe, device (terminal or modem, etc.), socket (Unix, IP4, IP6 - raw, UDP, TCP), SSL, a client for SOCKS4, or proxy CONNECT. It supports broadcasts and multicasts, abstract Unix sockets, Linux tun/tap, GNU readline, and PTYs. It provides forking, logging, and dumping and different modes for interprocess communication. Many options are available for tuning socat and its channels. Socat can be used, for example, as a TCP relay (one-shot or daemon), as a daemon-based socksifier, as a shell interface to Unix sockets, as an IP6 relay, or for redirecting TCP-oriented programs to a serial line.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I access usb port properties. I need to set permissions. sjpiv44 SUSE / openSUSE 7 12-12-2008 10:55 AM
why must I access a partition as root when permissions are set for me? newbiesforever MEPIS 5 02-07-2008 04:07 PM
Set-up a network interface with commands?? helptonewbie Linux - Newbie 2 11-22-2007 04:45 AM
How to set up network permissions for user accounts. Restrict network access. r00tb33r Linux - Networking 7 02-04-2007 09:10 PM
Several network interfaces: preventing access to one interface Pinguix Linux - Networking 1 11-30-2006 08:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration