Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Just like we add a user with administrator privilege or to server operators local group in windows so that he can add/edit/delete files/folders on the server, can I give such privilege to a user in Linux?

I want to close a network file which is open and situated on a Linux machine with NetFileClose API. Here the clients are all windows machines. I tested NetFileClose API successfully on a windows network, but had to add client ids to administrators group on the windows server machine otherwise I got ACCESS_DENIED_ERROR.

So in Linux when I tried to invoke NetFileClose API with servername as name/IP of Linux server, it returned with ACCESS_DENIED_ERROR. Also have a doubt regarding second parameter of NetFileClose API, Which is fileid as Linux doesn't have a concept like file id, instead it uses inode number. So Can I forcefully close a file opened on a Linux share(samba) with the use of winapi NetFileClose?

share|improve this question

migrated from stackoverflow.com Nov 15 '12 at 11:55

This question came from our site for professional and enthusiast programmers.

1 Answer 1

This is actually several questions rolled in one:


Q1: How do I give administrator (i.e. root) privileges to a user on Linux?

A1.1: You do not - in most cases you can fine-tune the access control lists for the resources of interest to allow access for the appropriate users.

A1.2: If that is not enough, sudo allows fine-grained access to privileged commands for normal users.

A1.3: If all else fails, you could make your files/folders world-writable. Of course that "solution" is about as acceptable as assassinating all your users so that you will not have a need for shared files in the first place... and it's only marginally better than creating another user with a zero UID.


Q2: How do I give administrator privileges to a user on a Samba server?

A2.1: You do not - the Samba configuration allows setting up users with administrator rights on a per-share basis - see the admin users = option in the smb.conf Samba configuration file.

A2.2: If you need to, then any user with root privileges should be able to have full access to the Samba server.


Q3: How do I use NetFileClose on a Samba share?

A3.1: If you have a recent enough Samba it seems to me that it should work, at least judging by the amount of related code in the Samba source tree. Someone more familiar with Samba should be able to verify.

A3.2: If you are using an old version of Samba, let's say more than three years old, then you may be out of luck, since I can trace the beginnings of the NetFilterClose() support somewhere in 2008...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.