Software :: How To Modify System Time As Non Root User
Nov 18, 2010
I have developed an application, in C language, that should received the EPOCH time (6 bytes) at about every 30 min. What function should I use as a non root user to modify the System Time.? The idea is that the same application could update the System Time. I am using Ubuntu.
I need to edit the system time as a not-root user. I am carrying out the following actions in my program.
1. Read the User Id of the process. User_ID= getuid() 2. Printing Capabilities(Permitted, Efffective, Inheritable)of the process 3. Setting UID = 0, using setuid(0) 4. Calling the prctl(), function to keep capabilities 5.Switching the UID from root to User_ID of the process 6. What we have now is a process with root capabilities as a non root user 7. On printing Permitted, Effective, Inheritable capabilities, I get the following --> Permitted = 0xfffffeff = Effective Inheritable = 0x0; with UID = 1001; 8. I then try and set the system time with --> system("date -s 10:00"); 9. I get an error: date: cannot set date: Operation not permitted 10. I am unable to understand as to why I cannot set the time even thought the capability bit CAP_SYS_TIME in the Permitted and Effective sets are SET.
get the values for the user time and system time for a process.i have tried getrusage to get values of ru_utime and ru_stimebut these don't seem to be correct
My linux distro is CentOS 5.3. Today I edited /etc/sysconfig/readonly-root and set "READONLY" to yes, now my /etc/sysconfig/readonly-root file is like this:
# Set to 'yes' to mount the system filesystems read-only. READONLY=yes # Set to 'yes' to mount various temporary state as either tmpfs
1. How sum of system time and user time can be greater than real time ? 2. Even though my program is not waiting for any I/O the real time is smaller than system time as shown
root@chaitu:/home/chaitu/Desktop/Chk# time ./new real0m0.001s user0m0.000s sys0m0.004s
I started to use Ubuntu 9.1 today. It's the first version of linux I'm using. So my problem is that I always got a message in terminal, that says "are you root?", when I try to do something with apt-get. Well i tried to install a root, but it didn't work. One thing I almost forgot. Root is the Superuser that should be put on, when I installed the current version of ubuntu right? I don't understand how could it happen that the system didn't put the root on.
I have a system running with few users and servers (apache/mysql/postfix). After extracting one tar archive in '/home' none of my users are being able to access their home directory. Even other system users (like www-data/mysql) are also not being able to access any directory. Only root can access the system. I have checked file permissions, many files/directories are set to 777 rest are 755.
What is the user account number when you create a root user account for the system during the installation of any linux distribution? I'm not sure if its 0, 1, 10, or 100..
I'm using Gnome and I'd like to still have the ability to reboot/shutdown from one particular account as well as root. How would I modify the chmod command to add this ability?Also, I have a few users who just will hold the power button in to shutdown the machine. How can I keep them from doing this?// Pruned from the vintage 2007 Prevent a non-root user from shutting down, rebooting or suspend the system thread. Please create new threads instead of resurrecting ancient ones.
Is It possible to change a process running in root-user to non-root-user by setting suid / uid / euid / gid etc... I so please instruct how, when and wat to set in order to change a process running in root-user to non-root user
The only user that can make the sound card work on a F10 x86_64 system is root. For non root users, I am not seeing any error messages when a app tries to use/access the sound card, just nothing plays. As I said, for root everything works as expected. I am sure this is a permission/setup issue, but I have no idea where to start.
I am trying to write a basic script on a linux box to do the following:change the timezone to UTC. I will need to make sure /etc/sysconfig/clock only has the following:
I am used to a certain root menu. I want to be able to modify the root menu. how do I do it. I mean the menu that come up when I right click on the desktop..
I am on x86_64 FC12 - Gnome.
currently it has "create folder, create launcher etc.. "
I am having dificulting with www-data as the user for apache2. I would like to change the user to my desktop user so that I can limit access to one unknown users. I am also having problems with my wordpress website and the permalink settings. which file I should look at modifing and what I need to modify?
I know if I run repquota -a I can see the quotas set for all users.How do I modify the quota for a specific user?So say the output for john is:User used soft hard grace used soft hard grace----------------------------------------------------------------------john.someth -- 122844 51200 51200 4995 0 0How do I make his block limits 0 so they are unlimited?
I spent some time programming a useful script which presents the user with a UI of all the samba/W2K8 servers and shares on the domain and they check off the shares and the script maps them. The script can only be run as root because mount doesn't allow users to execute. I was asked to modify the script to allow non-root users similar features. I was able to get this working by running the commands:
Can someone please explain to me what the 's' option means? The man pages only go as far as to say that it allows for setting suid but I don't really know understand that means or what the implications are by doing this. In a perfect world I would like to create a security group and add users into that group and then grant that group permission to run mount.cifs/umount.cifs rather than making such a drastic global change to a core binary. how I might go about granting members of a group permission to run hand-selected commands like mount.cifs?
Post added at 07:07 PM Previous post was at 04:40 PM Ok, I read up on the /etc/sudoers man page and I think I have a more elegant solution to this problem of user mountable samba shares. I restored my mount.cifs back (chmod -s /sbin/mount.cifs) and I used visudo to grant the access.
Code: %smbusers ALL=NOPASSWD:NOEXEC:/sbin/mount.cifs,/sbin/umount.cifs This allows any users in the smbusers group to run mount.cifs/umount.cifs with sudo but without being prompted for a password.
I recently started using SVN with Apache for my web development, although I find it really annoying that I have to issue two SVN commands (one local, one remote) to update my web site. I have been looking into SVN post-commit hooks to solve this problem. The only problem is that apache does not have permission to modify files in my user directory... So here is how everything is setup. I am running Slackware 13 full install. There have been no installations overriding any of the default installs.
I'm connected to the internet using a wireless router. Each time I boot, I have to grant root privileges and type in a shell: iwconfig wlan0 essid linksys key dhclient wlan0 Isn't there a file(or location) that I can modify to automatically grant root privileges and execute these commands when debian starts? Something like autoexec.bat in windows.
Something else I'd like to mention is when I execute iwconfig.... for the first time, I get this incomplete result:
IEEE 802.11bg ESSID:"linksys" Mode:Managed Access Point: Not-Associated Tx-Power=27 dBm Retry long limit:7 RTS thr:off Fragment thr:off Encryption key*********** Power Management:off
look at this : Uploaded with ImageShack.us how can set permissions in linux like this? I want one user can delete files but can't modify them and ... in linux i have 3 group to assign read write and execute them. is ntfs flexible than linux file system?
We are looking to monitor and log selected application file systems for file create/modify/delete changes that will also include, user account that changed/deleted the file, file name and date and time of event. Everything I have looked at does not seem to provide all of the information that we need.Inotify seems to monitor modify/create/delete but does not seem to provide the user account. Auditd seems to monitor modify/create/append with user account, but not deletes.We need to provide this information to auditing for Sarbane Oxley compliance.
I want to forbid a user to make changes to preferences of iceweasel, specifically to modify proxy settings of the browser. Although user should still be able to use the browser.
I assume these settings are stored in some file on a harddrive? If so, what is this file and can i simply make it read-only for users? Or any other solution?
For my work, I have to modify the routing lookup process at Linux kernel.
The details is below:
A-----B.
We have pcA, pcB (using Linux OS kernel 2.6.26.5) connect together. We need to modify the source code of kernel at B in order to if A sends the packets with destination IP address as C, pcB still receives this packet and send to transport layer (that means, it bypass the routing lookup process at kernel).
i am having problems with privileges i have created a new user with my name, but i cant get root privileges on it. i need the same privileges as the root profile.