w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Running python cron script as non-root user
Cron jobs run with the permissions of the user that the cron job was setup under. I.E. Whatever is in the cron table of the reports user, will be run as the reports user. If you're having to so sudo to get the script to run when logged in as reports, then the script likely won't run as a cron job either. Can you run this script when logged in as reports without sudo? If not, then the cron job can't either. Make sense? Check your logs - are you getting permissions errors? There are a myriad of reasons why your script would need certain privs, but an easy way to fix this is to set the cron job up under root instead of reports. The longer way is to see what exactly is requiring elevated permissions and fix that. Is it file permissions? A protected command? Maybe adding reports to certai

Categories : Python

Jetty bash script works only with root user
Check the ${jetty.home}/logs/start.log (or similarly named log file) That will tell you why it failed. Also, you might want to look into the optional setuid support. http://www.eclipse.org/jetty/documentation/current/setuid.html

Categories : Linux

Linux skip /root/.gvfs when executing df command with non-root user
I got the solution for my own question :) In df command you can pass the file system types which you would like to exclude, in this case it is 'fuse.gvfs-fuse-daemon'. So when I execute the below the command I no more get this message "df: `/root/.gvfs': Permission denied" df -x fuse.gvfs-fuse-daemon For more details one can look into df --help option.

Categories : Linux

Is sudo-ing tomcat's startup with a non-root user the same as running it as root?
Do be aware that the recommended solution to run tomcat on port 80 is to use mod-jk with the Apache web server, not to have tomcat listen on port 80 directly.

Categories : Unix

Remote login as root in ubuntu
Ubuntu documentation says: By default, the Root account password is locked in Ubuntu. It also says: Please keep in mind, a substantial number of Ubuntu users are new to Linux. There is a learning curve associated with any OS and many new users try to take shortcuts by enabling the root account, logging in as root, and changing ownership of system files. It talks at length about why it's been done this way. Enabling the root account: sudo -i To enable the Root account (i.e. set a password) use: sudo passwd root Use at your own risk! Logging in to X as root may cause very serious trouble. If you believe you need a root account to perform a certain action, please consult the official support channels first, to make sure there is not a better alternative.

Categories : Linux

Ubuntu 12.04.2 server auto enter root shell in recovery mode
After further study, I thought I had figured it out. Two changes are needed: (1) update the grub.cfg to customize recovery mode - open /boot/grub/grub.cfg - revise the menuentry "linux ...... ro recovery nomodest ...... " to "linux ...... ro single ...... " (2) There is known issue of GRUB in the 12.04 64bits, where the change of timeout is not converged into final grub.cfg (/etc/grub). You have to revise "set timout=-1" to "set timeout=0" in the auto generated grub.cfg or do below, §/etc/grub.d/00_header –In the make_timeout() function: replace the if/else/if block with "set timeout=${2}“ before executing update-grub. Actually, you should do step (2) first and then step (1)

Categories : Linux

what 's difference between android system user and linux root user
As far as Linux is concerned, the system user is just a regular user (UID 1000). Android services however give it special permissions and you can get access to pretty much anything. Most services have code like this somewhere: private static final void enforceSystemOrRoot(String message) { final int uid = Binder.getCallingUid(); if (uid != Process.SYSTEM_UID && uid != 0) { throw new SecurityException(message); } } What that does is deny access to anyone who is not root or system. The shell user (UID 2000) (what you get when doing adb shell) is another user with a lot of power (member of many groups). Cf. system: $ su 1000 $ id uid=1000(system) gid=1000(system) groups=1003(graphics),1004(input),1007(log),1009(mount), 1011(adb),1015(sdcard_rw),1028(sdc

Categories : Android

CakePHP: Warning (512): Model "User" is not associated with model "User" Windows to Ubuntu Deployment
About the 512 associated error: $this->User->contain(array('User', 'Role' => array('Ui', 'Action.name'))); Change to: $this->User->contain(array('Role' => array('Ui', 'Action.name'))); Don't contain the model itself. About the LDAP error, seems to be this line: $this->exists = ldap_bind($this->ds, $user, $pass); I would start with some code like this to debug: var_dump($this->ds); var_dump($user); var_dump($pass); $this->exists = ldap_bind($this->ds, $user, $pass); Copy-paste this data into some LDAP tool and first verify they are correct. Try this function to get more error information: http://php.net/manual/en/function.ldap-error.php

Categories : Windows

Trying to run a python script from ubuntu crontab
I'm not sure what you expect to happen here. The cronjob won't have access to a display where it can display the GUI, so the button will never be displayed, so print_this will never be run FWIW, when I tried to run your code I got an error: File "./t.py", line 4 def __init__(self,parent): ^ IndentationError: expected an indented block Not sure if that's just caused by copy/paste into the page or if it's a real problem with your code.

Categories : Python

Auto run script in root mode
You should use sudo - your command available in root mode without password for user or group Cmnd_Alias YCMD = /usr/local/somecommand username ALL=YCMD, NOPASSWD: YCMD

Categories : Unix

starting a python 3.3. script at ubuntu startup
The shebang line #!/usr/bin/python3 should work if sh, bash, etc. is trying to launch your script. It it is being run from another script as python myscript.py you'll have to find that script and get it to launch the script using python3 myscripy.py

Categories : Python

Python script on Ubuntu VM can't connect to twitter API
Try creating a https handler and see if that fixes the problem. Change this line: proxy = urllib2.ProxyHandler({'http': 'http://my-proxy-server:80'}) to proxy = urllib2.ProxyHandler({'https': 'http://my-proxy-server:80'}) and see if that works, since the Twitter API you are trying to access is over HTTPS.

Categories : Python

ubuntu ec2 - run python script at startup with arguments
Your /etc/init.d/script_name is missing the plumbing that update-rc.d and so on use, and won't properly handle stop, start, and other init-variety commands, so... For initial experimentation, take advantage of the /etc/init.d/rc.local script (which should be linked to by default from /etc/rc2/S99rc.local). The gets you out of having to worry about the init.d conventions and just add things to /etc/rc.local before the exit 0 at its end. Additionally, that ~ isn't going to be defined, you'll need to use a full pathname - and furthermore the script will run as root. We'll address how to avoid this if desired in a bit. In any of these, you'll need to replace "whoeveryouare" with something more useful. Also be warned that you may need to prefix the python command with a su command and som

Categories : Python

How to check if running as root in a bash script
If the script really requires root access then its file permissions should reflect that. Having a root script executable by non-root users would be a red flag. I encourage you not to control access with an if check. chown root:root script.sh chmod u=rwx,go=r script.sh

Categories : Bash

Running shell script as root using apache/php
You look for tool called sudo: https://en.wikipedia.org/wiki/Sudo But most likely instead of going for sudo you should rethink your app architecture as once your httpd is compromised, attacker can easily get root rights.

Categories : PHP

How to know if user is root or fakeroot?
It looks as if your binary (busybox) is compiled against a static libc. fakeroot uses dynamic library preloading to intercept and replace calls to various libc functions, but this only works if your binary is dynamically linked to libc. If it is statically linked, the function calls are bound to the real calls inside the binary, so there is no way to intercept them.

Categories : C

How to run node.js as non-root user?
Option 1 requires you launch the node server as root. Not ideal. Option 2 adds overhead to every handled request and adds another failure point to your stack. Option 3 Is the simplest and most efficient method. To implement Option 3, add the following to your system init scripts. (/etc/rc.d/rc.local on RedHat based systems like AWS). iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000 That will redirect requests from port 80 to port 3000.

Categories : Node Js

Make a one word command for my script to use in ubuntu terminal
# alias tetras=/home/user/tde.sh If you wish, put that in your .bashrc file. http://www.lehman.cuny.edu/cgi-bin/man-cgi?alias+1

Categories : Bash

python script to .deb ubuntu package to install a daemon
You should look for the debian packaging doc for python, other that can be useful is the stdeb tool, a Python to Debian source package conversion utility. For running it as a daemon you need to create a init.d script (you can see how to here, and here a more complete example), you can add the init.d script in the package and then call "update-rc.d myscript defaults" from the postinst script of the python.deb and call "update-rc.d -f myscript remove" from the prerm script.

Categories : Ubuntu

Launching C executable via ruby script on Ubuntu server
You can do like this original_file_path = 'path/to/original_file.dat' modified_file_path = 'path/to/modified_file.dat' File.write(file_path, 'data') #this will return an output from c program #use this if you need to parse output from c program result = `some_c_executable --some_flag #{file_path}` #parsing result... data = File.read(modified_file_path) #work with data Or #if you don't need output from c program, use "system" #it returns you true or false according to success result = system "some_c_executable --some_flag #{file_path}" if result data = File.read(modified_file_path) #work with data else ... end

Categories : Ruby On Rails

Different ways to switch a user on Ubuntu
Here's a good link describing the difference between hyphen and no hyphen su. I'm guessing no-dash works for you because the environment variables are left alone.

Categories : Ubuntu

How to execute local script as root in remote servers?
Use SSH Keys to avoid having to enter a password view this link: https://wiki.archlinux.org/index.php/SSH_Keys

Categories : Linux

How to run a Ruby script in Sublime Text 2 from project root
Depending on your scripts you might want to look into using Package Control and the SublimeREPL Package. SublimeREPL allows you to have a Ruby Interpreter in a separate tab or window in SublimeText. Running CMD + Shift + B has never been very reliable in SublimeText for Ruby code anyways. Also, similar answer to similar question: Execute Ruby code in sublime text 2

Categories : Ruby

How to run tshark commands from root mode in linux using TCL script ?
You have to either elevate the privileges of your tshark process via sudo (or any other available means) or run your whole script with elevated privileges. One way to do that which might be simpler than sudo as it would require zero customizations is to write a super-simple C program which would just run /usr/bin/tshark with the necessary arguments and then make that program setuid root and distribute along with your Tcl program. That is only needed if you need portability. Otherwise sudo is much simpler.

Categories : Linux

How do I fix "Error: MONGO_URL must be set in environment" on ubuntu using forever and startup script?
Try passing it onto forever straight without using the export before: exec PORT=80 MONGO_URL=mongodb://localhost27017/parties ROOT_URL=http://ec2-54-235-1-185.compute-1.amazonaws.com forever start bundle/main.js It might have something to do with the permissions, when using a startup script the user might be something that has its own variable scope to the ones set.

Categories : Ubuntu

Unable to create user on Ubuntu on Amazon EC2
You are probably thinking of adduser which has interactive prompts for most of the fields. See this question. useradd and userdel are for creating accounts in scripts where you don't want to be prompted. By default they will only create the user and requires additional command line options to create the home directory etc. You will find it did create the account (look in /etc/passwd) and the complaint about "already exists" confirms this. How do you remember the difference? No idea. Seems to be one of those historical things you just need to know.

Categories : Amazon

How to reset the Registry Editor view back to root using VB script?
By deleting the "LastKey" which holds the last key viewed in the Registry Editor, the view returns to the root view. WshShell.RegDelete "HKLMSOFTWAREMicrosoftWindowsCurrentVersionAppletsRegeditLastKey"

Categories : Windows

Windows batch script to name files after containing subfolder and copy to root
Here I made this my self. I created a similar situation to yours and it worked fine for me. However you have to specify the location to copy all the files to. for /d %%a in (*) do ( cd %%a for /r %%b in (*) do ( copy %%b C: [root] \%%a%%~xb ) cd.. ) pause Hopes this helps. Yours Mona.

Categories : Windows

Why do I get "Access denied for user 'root'@'localhost'"?
Basic trouble-shooting 101: If the literal strings work, and variable assignments don't, then suspect your variable assignments; Something could be wrong with one of them, such as an invisible character. Try: vars = ('localhost','root','admin','one') Mysql.new(*vars) Then try: vars = %w(localhost root admin one) Mysql.new(*vars) or: host, username, password, db = %w(localhost root admin one) Mysql.new(host, username, password, db) or: host, username, password, db = 'localhost','root','admin','one' Mysql.new(host, username, password, db) The idea is to start with what you know works, and work backwards until assigning to variables works, or it breaks. At that point you've either fixed the problem (possibly without knowing why), or you've learned what broke it. Either way you'r

Categories : Mysql

Unit test for only root user in python
If you're using unittest, you can skip tests or entire test cases using unittest.skipIf and unittest.skipUnless. Here, you could do: import os @unittest.skipUnless(os.getuid() == 0) # Root has an uid of 0 def test_bla_as_root(self): ... Which could be simplified in a (less readable): @unittest.skipIf(os.getuid())

Categories : Python

Fabric sudo as another user with root privileges
1: You said MyAppUser wasn't in sudoers. So it can't run sudo. Use the debug flag to see this, but you're essentially doing this: $ ssh MyAppUser@myapp.mycompany.com "sudo -u me 'sudo cp ...'" So if MyAppUser can't sudo at all, then fabric connecting as this use can not sudo. 2: If you have multiple users able to connect to this machine, use the settings() context manager or the execute() function and supply me (see prompted user) as the user to connect with in the host string. eg: execute(setup_task, host="me@myapp.mycompany.com") Where setup_task is the task doing the copy into the init dir.

Categories : Bash

Devise custom user root is not working
My problem was that I was redirecting in the after_sign_in_path(resource) method instead of just returning the path: def after_sign_in_path_for(resource) return user_path(:user_id=>current_user.id) end is the correct way to do this.

Categories : Ruby On Rails

User able to modify file owned by root. Why?
You don't change a file when renaming it or moving it in the same filesystem, because a file is really an inode (which may have zero, one or more filenames in directories). Renaming a file is an operation inside the relevant directories (not on the file itself). Perhaps removing write access to the directory might help (but if the user owns the directory, he could change again these permissions on the directory with chmod). Read also more about sticky bit on directories. BTW, the user could also hard link that same file, i.e. add a new filename to it. Then each filename is refering to the same file.

Categories : Linux

Access denied for user 'root'@'localhost'
Start mysql client in the console and execute this query: select Host, User from mysql.user;. You MUST have a row like this: +----------------+------------------+ | Host | User | +----------------+------------------+ | localhost | root | +----------------+------------------+ a row with "localhost" in Host and "root" in User. If you don't have it that's the cause of your problem (it doesn't matter if you have other rows with "root" in User) If you don't have such row, add a new user with this: CREATE USER 'appUser'@'localhost' IDENTIFIED BY 'appPassword'; Change 'appUser' by 'root' if you want, but I strongly suggest to use another user. Then add permissions to your new user by executing this in the mysql client: GRANT ALL PRIVILEGES O

Categories : Java

mysql reset root user privileges
I have had issues with GRANT ... TO 'user'@'%' ... before. Try to additionally issue the following GRANT statement: GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION; For me, this did the trick. Somehow mysql seems picky when it comes to localhost

Categories : Mysql

Creating another user account having power of root
Each Unix system should have one, and one only, root user. Unix systems are built on that rule. If you want to promote a user for any reason, the user should use the sudo command. $ sudo <command> <options> Or allow temporary super-user by loging in as the root (use with extreme caution) $ su One should manually edit the sudo configuration to specify which user can do what: $ sudo visudo Then you can add users one by one or add a group of users. Another way, would be to add users one by one to the sudo group. $ sudo adduser <username> sudo You said you updated the sudoers list. Then your user should be able to run sudo. If not, your configuration might be wrong. Remember to always log out and in after you modify the current user's sudoers' privileges. Or yo

Categories : Linux

How to run AT commands in Android terminal as root user?
You can use the program atinout which will allow you to easily send AT commands from the commands line. Example to hang up a call: $ echo ATH | atinout - /dev/ttyACM0 - ATH OK $ You need to find the name of the serial device for android (on desktop linux it is typically /dev/ttyACM0 but Android use something different as far as I remember).

Categories : Android

sudo: different path variables for root and user
Try the following command in your user account: env | grep ^PATH= Now, compare this to the output from the same command run as root: sudo env | grep ^PATH= Are the paths the same?

Categories : Linux

Get user root directory from windows service
I found this under Win7 registry. XP looks to have the same registry keys, but the values have "All Users" profile within it. [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionExplorerShell Folders] "Common Desktop"="C:\Users\Public\Desktop" "Common Start Menu"="C:\ProgramData\Microsoft\Windows\Start Menu" "CommonVideo"="C:\Users\Public\Videos" "CommonPictures"="C:\Users\Public\Pictures" "Common Programs"="C:\ProgramData\Microsoft\Windows\Start Menu\Programs" "CommonMusic"="C:\Users\Public\Music" "Common Administrative Tools"="C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools" "Common Startup"="C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup" "Common Documents"="C:\Users\Public\Documents" "OEM Links"="C:\ProgramData\OEM Links" "Common Template

Categories : C#

Numpy segfault on large SVD as user but not as root
Looks like the comment is the answer, hence re-posting it as such: I would check if you are using the same python and libraries with the two accounts. Maybe the PATH, PYTHONPATH, LD_LIBRARY_PATH env vars are different and you are using a different version with the root account.

Categories : Python



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.