Programming :: C++ Codes To Check Whether User Is Root Or Has Admin Rights
Jan 8, 2011
One of the feature in my application involve changing of hardware setting. This require the user to be root or have administrative right.Before my application enable that feature, I want it to check whether the user is "root" or not, or whether user use "sudo" command to run the application or not, or whether the user has administrative rights or not.What are the codes or library that can do this?
NOTE: Sometimes, advanced linux user may set the user id of root to something else other than 0. So, getuid() may not be helpful in this case.
I have created a new user using sudo adduser "user1" from the root .but this user does not have full admin rights...How to give full access to this user1?
I'm having a bit of a problem after joining Ubuntu 9.04 to my company's Windows Domain. I can log in and use sudo just fine but I don't have access to certain things in my menu (i.e. "Add/Remove Software") and I can't open the User Manager. I manually edited the /etc/group file as root and added my username (username@domain) to the appropriate groups but still no luck.
I'm a new Ubuntu user and a Python programmer, it's the first time that I use Python in Ubuntu so it's a bit confusing me. If I want to save a Module or something in a specified map, I get 'Errno 13', it says that I don't have permission to edit, do thing in that map. And this is also for importing files with Python. I logged in from Terminal with 'sudo -i' and closed Terminal, but the problem keeps repeating. How do I login as Admin or Root and stay as Admin or Root? I need right to edit/read files as well as root and normal user.
An example: Python file: test.py -> test = open('/a.txt', 'w') test.write('Test - Test - Test') test.close
When I execute this, I get in the Python IDLE the 'Errno 13' problem and below the 'Errno 13' it says that I don't have permission. Who know how to stay logged in as root, even if the user has not logged in or isn't this possible, if it isn't then I just want to get files moving, editing/erasing etc.
I have my own 16GB sandisk cruzer flash drive, I've already mounted him and can read on my own user, but I can write on it only using root. how can I give my user Chmod +x on the folder /media/XXX ?
I'm using Debian Jessie Cinnamon right now. I've got 1 user account on my machine--fred--as well as root, of course. "fred" is an administrator, and many times that is enough for root priviledges, for example, I can install packages via apt or dpkg. However, I cannot access "Users and Groups", or install packages via GDebi, with my password. For that, I have to have the root password.
I know that it is possible to let the admin account handle everything and not even need root--for example, Mint and (I believe) Ubuntu do it this way. I don't know how, though.
Code: Select allgroups fred fred : fred cdrom floppy sudo audio dip video plugdev netdev lpadmin scanner bluetooth
I did disable the root account by Code: Select allsudo passwd -l root to see if it would make any change. Nothing different happened except that I now can't use GDebi or access "Users and Groups" since the root account and therefore password is inactivated. Not a big deal to get it back, though.
I am using linux mint and have installed Netbeans on it but whenever I run netbeans from accounts other than root it throws an error for not having permission to start glassfish server of netbeans. I also tried running this application using run as administrator option but then the application does not start.
So is there a way to assign netbeans admin rights permanently so that whenever I start this application from other accounts I should not face this error?
I cant change my user settings (password, login screen settings etc) after upgrading to 10.4 on my desktop pc. It says I don't have rights. I'm the only user, no other profiles. Otherwise seems to be working fine!
I am only user on this ubuntu 10.10 install. I have admin rights but when I try to change some settings via Ubuntu tweak unlock or alter user and groups via advanced tab I never get the option to enter my password. I have added a new user 'tempuser' via safe mode and this user is administrator too but everything works fine from this user..
Results from $ grep admin /etc/group lpadmin:105:heath,tempuser admin:119:firstuser,tempuser,heath
Results from groups admin adm dialout fax cdrom floppy tape audio dip video plugdev fuse lpadmin sambashare I am thinking of making a fresh install if I cant sort this but would like to fix if possible.
I've got a Dell laptop with a dual boot with Ubuntu and Windows 7, but I want windows 7 to be the default OS. I can't seem to find anything on Ubuntu with any information. I had a look at some forums and it said I need to go into admin, but I don't think I have it. Does anyone know how to get Admin rights and how to change the default OS?
I have moved to a new place and they expect me to work without root access to my machine, but I need to compile and make some software. However I get the following error:
mkdir: cannot create directory '/usr/local/ope': Permission denied chmod: cannot access '/usr/local/ope': No such file or directory mkdir: cannot create directory '/usr/local/ope': No such file or directory chmod: cannot access '/usr/local/ope/bin': No such file or directory make[1]: *** [/usr/local/ope/bin] Error 1 make[1]: Target '_installall' not remade because of errors.
I have been allegedly been given admin rights - but do I need root to do this?
I am semi new to linux and i was getting the hang of it until just recently. I'm trying to do some web design using php and mysql. In my reference material (the all in one desktop reference {for dummies}). At some point I needed to do something in /var/www but I ran into a permissions problem so I typed: Code: chgrp -v -r guy0203 /var/www 405 chgrp -v -R guy0203 /var/www 406 chown -v -R guy0203 /var/www
Afterwards in some subsequent step it suggested putting the files in /usr/src/mysql. Since I didn't have that folder I used mkdir and created it. Then I tried adding the files I needed to that folder and got denied on the grounds of not having permissions once again. So tried something like this: Code: 451 chmod 777 /usr/ 452 sudochmod 777 /usr/ 453 sudo chmod 777 /usr/
It was a 755 originally but I couldn't copy those commands. It turns out as that I had two terminals open in different desktops. one of them was a root terminal. It was at this point that realized that I was in that root terminal and decided I was done 'learning' for the day. I decided to listen to some music (which is located in my windows partion) and ran into a problem. The prompt that pops up to normally asks me for my admin PW to mount the drive. Now just vibrates like an incorrect entry was received, says authentication error and says I am not authorized to mount that drive then I went back to terminal to fix it, and when I tried to elevate myself to SU:
I got this: Code: guy0203@guy0203-laptop:~$ sudo su sudo: must be setuid root guy0203@guy0203-laptop:~$
I don't know what to do now but I think I totally killed this OS. If so is there anyway to save things if I have to reinstall?
I created a custom linux distro that originated from ubuntu server and I installed time-admin and want to change the time without admin rights. Is this possible?
I have OpenVPN setup and running on my home server (Lucid Lynx). I move around alot and use Portable OpenVPN to connect to my home server. The problem is a lot of the computers I use I do not have admin rights to install the necessary routes to connect. So my question is this. Can OpenVPN be configured to use PPTP protocol? Because I have PortableVPN on my U3 flash drive and that VPN client does not need admin rights to run. If OpenVPN cannot do this, and from my understanding of its archetecture it cannot, but I must admit i am no authority on the matter. Can you suggest a workable solution, ie. install and setup this server software and use this portable client software.
i have a ubuntu server box with samba 3 as domain controller with all windows 7 clients.i am wanting all users to have local admin rights so they can install programs etc.
I would like to install a more modern version of GNU utils (coreutils) on a debian linux system where I have no admin rights. Is there a way to do that?
The rationale is that I need a more modern version to the one installed in the system where I intend to run my analysis. I am trying to use "sort -R" or "shuf" to randomize lines in a big text file.
I have a user account which is required to run as part of the operating system and as a service. I am currently attempting to install my companies software on an Ubuntu desktop via wine just for the purpose of finding out if it's do-able.
Is there a way, in Ubuntu, for a user account to be given the local rights assignment to act as part of the operating system and to function as a service in the background?
Original HOWTO can be found at: [URL]... So the other day I was in IRC and someone had brought up a problem where they created a new Administrative user, but didnt have rights to use sudo. Looked into the problem a little bit to figure out what was wrong, and it turns out that when you create a new user through the user manager (in kubuntu, anyways. Havent tested in Gnome.) the user gets added to the adm group, however, a quick look at the sudoers file shows that its looking for users in the admin group to allow the use of sudo. So, to solve the problem we do the following: If youre on the new admin user (which Im assuming you are) use the following commands:
Code: su [insert username of old account without brackets] sudo usermod -G admin [username of new admin account without brackets] exit
Then simply logout, and then log back in (not always necessary, but the easiest way to flush the permissions.)
Code: su [insert username of old account without brackets] Means were going to Switch User to the old admin account Code: sudo usermod -G admin [username of new admin account without brackets] This simply adds the admin group to the secondary group list for the new user Code: exit Pretty self explanatory
I have been searching for 90 minutes for something that I "think" should be fairly easy. I'm pretty new to Bash Scripting so I could be completely wrong. Then again it may be a weird request to even need something like this. But here it is.I have a script written to convert data from one of our software version to another. The only thing I need to add to it is a "check to make sure the user running the script is in the /tmp directory".
When I insert some homemade DVDs of a friend, I can't view its contents. DVD works fine on windows XP, but not on opensuse. Dolphin gives an error: access denied to /media/071114_1638.I can't do a chown command because dvd is read-only...And when I do an ls -l I get:
Quote: The open-source Linux operating system contains a serious security flaw that can be exploited to gain superuser rights on a target system. The vulnerability, in the Linux implementation of the Reliable Datagram Sockets (RDS) protocol, affects unpatched versions of the Linux kernel, starting from 2.6.30, where the RDS protocol was first included.
According to VSR Security, the research outfit that discovered the security hole, Linux installations are only vulnerable if the CONFIG_RDS kernel configuration option is set, and if there are no restrictions on unprivileged users loading packet family modules, as is the case on most stock distributions.
I can't seem to remove rights for a remote root connection. Below you can see that the rights are present before and after the successful revoke command. I am using the correct command.
I've compiled some code which I've given to other people, however when they try to run it they get segemtation fault. After some testing I've found if it's ran from root (where I compiled it) everything works, if I try to run from a user there's a fault.
I'm new to Ubuntu and wish to use the system in combination with Apache/mySQL/phpMyAdmin. I managed to get phpMyAdmin working for now. Also mySQL database seems to work. Only problem is Apache2. I can start the server and it is working. However in the folder /var/www/ where all site files are stored, I can not edit anything. I have been reading about sudo nautilus which did allow me to change administrator rights for the folder, but still I do not get it working to display other than the default index.html page. Is there a manual or quick solution for me so I can use apache with Ubuntu?
Is there any way a non-root user can programmatically determine which days the computer ran during, say, the last month?
The information is in /var/log/messages.* but those files are root:root 640.
Non of the world-readable /var/log files on the Slackware 13.0 development system can be used:boot Not present if boot logging not enabled (default). dmesg No timestamps. lastlog Not enough info. wtmp Rewritten on each boot so not enough info. EDIT: not correct: by default wtmp is rotated weekly and kept for one month as configured in /etc/logrotate.conf xdm.log Not present if xdm not used. Xorg.0.log Not present if X not run.
I am writing a ping kind of program for my own application. This application needs to run with non root user privileges. This needs me to create a raw socket. But the ping connection is failing because of creating raw socket with non root user.How can I run the application successfully with non root user privileges using raw socket creation?
I am working on a large program in C to run on Puppy Linux. I have multiple pthreads running. I want to be able to set the pthread SCHED_POLICY and priority in my program but I want a user to be able to run the program without root privilege. Using a sticky bit and root ownership gives the user too much power because they will be able to write and compile their own scripts. Is there a way to use 'sudo' when I set the thread parameters from my program or something like this?