w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
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

Qt | SQLite Database executes every command twice
Look at QSqlQuery::QSqlQuery ( const QString & query = QString(), QSqlDatabase db = QSqlDatabase() ) method documentation: If query is not an empty string, it will be executed. So if you specify a database to the constructor, the query will be executed immediately. You should not call exec after that. You can use QSqlQuery::isActive to check if a query was successful. Also I think you should create a class member for your QSqlDatabase object, initialize it in init() and return it in db(). It will be more clear because it's hard to understand what QSqlDatabase::database does without reading its documentation. Also QSqlDatabase::database creates some small but unnecessary overhead. You're not supposed to call it so many times.

Categories : Qt

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

bash echo executes command instead of printing it
You should'nt be really parsing ls for this. Do something like: for f in *; do echo "File -> $f"; done For directories: for i in *; do if [ -d $i ]; then echo "File -> $i"; fi ; done or find . -type d -exec echo '{}' ;

Categories : Bash

Android - Bluetooth socket close command executes before OutputStream is Flushed
Closing the socket's output stream flushes it and closes the socket. Closing the socket itself is redundant. In your actual code it should do nothing at all, so adding a sleep before it should just be a waste of time. Do you have any actual evidence for your strange belief that your program doesn't execute sequentially as written. I would try removing the socket close.

Categories : Android

(Solution-Wide pre/post events) MSBuild target executes in command line but not in VS
This is a known VS feature/bug. As mentioned, VS does not build in the same way as msbuild. Msbuild on the commandline generates an msbuild file from the solution (if you set the MSBUILDEMITSOLUTION environment variable to 1, you'll see a .metaproj file generated for your solution in which the before/after targets are imported). It's my understanding VS does not do that but instead invokes msbuild programatically with no extension points for the solution.

Categories : Visual Studio 2012

JQuery script on an Asp.Net Web User Control Executes More Than Once
Try to change your javascript as follows: <script type="text/javascript"> function slideToggle(e, ui) { debugger; //find the right control to slideToggle var ct = e.currentTarget; var controlHolder = ct.parentNode; //up the dom one element $(controlHolder).find(".expandableContent").slideToggle(500); //back down the dom to the element we want to animate } $(document).ready(function () { //find the right control to hide var pare = $('.helpControlHolder'); pare.find(".expandableContent").hide(); }); $(function(){ $(".expandableHeading").click(function (e, ui) { e.preventDefault(); slideToggle(e, ui); }); }); </script> Hope it helps.

Categories : Jquery

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

How do I create a grid command in kendo UI that executes and returns an Ajax response which updates the grid
Look at this sample on the Kendo UI Demos. Basically if you want to emit a custom button or something else that runs some code that does Ajax, you're going to have to dive into some JavaScript most likely. .Toolbar(tb => tb.Template(@<text> <button onClick="return importExchangeRates();">Import exchange rates from ECB</button> </text>); Then in your scripts (client-side): function importExchangeRates() { // perform Ajax request here, refresh grid in success handler var grid = $("#exchangeRateGrid").data("kendoGrid"); // return false to prevent button doing silly things with the page in some browsers return false; } I worry that you might be wanting two different data sources for this grid, just from the way you have worded things. If s

Categories : Asp Net Mvc

how to execute a command as root
If you are a user on your system that has sudo privileges to run commands as root, just pre-pend sudo to the command. system("sudo yum install some-package"); If you want anybody to be able to do it, then you have to be administrator on your system, change the owner of the file to be root, and modify the permissions of your executable to run as root. By doing so, you do not need to modify your system() command string with sudo. chmod +s my_program chown root my_program Realize that doing this may open you up to security problems, unless you have proven that your program has no security issues. The file-system may be such to disallow you from setting the setuid bit on your program. If you need more information along these lines, you should consult SuperUser.

Categories : C

Fabric: Run command as root automatically
If you're using fabric you can just provide the -u argument from the command line to specify which user you want to run the task as fab -u root <task name> For more options from the command line check out http://docs.fabfile.org/en/1.7/usage/fab.html#command-line-options You can also set your username programmatically from fabric.api import run, settings with settings(user="root"): run("some-command")

Categories : Python

Kill/Debug own process from command line without root access
Now I have only rooted devices for debug :) About enable debug application from cmd line.. I try use adb shell am set-debug-app <package>. But this way work not as I want. After this command my process stopped and after next start, yes, application was started under debug. But I want enable debug without restart process.

Categories : Android

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

Can't find AD user using the command get-aduser when the user is an object
You can assign the username to a variable and use it in the query: $name = $arr[0].username $user = get-aduser -filter {Name -eq $name} or use an expanded string instead of a script block: $user = get-aduser -filter "Name -eq '$($arr[0].username)'"

Categories : Powershell

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

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

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

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

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

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

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#

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

(Rails) Test if user tries to get root directories
Try this: def path_valid?(path, base = Rails.public_path) expanded_path_name = Pathname.new(path).realpath.to_s expanded_path_name.starts_with? base end Pathname#realpath will resolve a path to an absolute path, as well as do symlink resolution. This will let you test precisely where the path of the file to be operated on is, and ensure that it is inside a given path.

Categories : Ruby On Rails

Running/Debugging an app on Xcode as root user
I think running things as root is typically not advised, and I think that you wouldn't be able to get special write access on an actual device, but you could try logging in as root on your mac and launching Xcode from there. I have not tried it, but it may enable the "Run as root" option

Categories : IOS

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

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

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

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

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

Launch a Python GUI from a C program running with user root
The reason it works when you run it the first way is that the DISPLAY environment variable is already set before you start the C program, and it will be inherited by subprocesses. If you're launching the C program on bootup, the DISPLAY variable (probably) won't be set, so you'll need to set it before spawning the subprocess, with something like... #include <stdlib.h> setenv("DISPLAY", something, 1); // Now launch the Python script The tricky bit is what to put in for something. It needs to be whatever you get when you do echo $DISPLAY from a regular X11 session, assuming the C program runs on the same system as your X11 session. You'll either have to hardcode a value which works, or find some way to pass the correct value to the C program. Update Regarding permissions issu

Categories : Python

WampServer - Access denied for user 'root'@'localhost'
Wamp is usually without a MySQL-password. Try replacinng C:/wampdirectory/apps/phpmyadmin-versionthing/config.inc.php, with this version: (simply remove THE WHOLE CONTENT of your current file) <?php $cfg['blowfish_secret'] = 'a8b7c6d'; $i = 0; $i++; $cfg['Servers'][$i]['auth_type'] = 'cookie'; $cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['AllowNoPassword'] = true; $cfg['UploadDir'] = ''; $cfg['SaveDir'] = ''; ?>

Categories : PHP

MYSQL Access denied for user 'root'@'localhost'
It was absolutely correct what you did,but I guess not working just for a small thing.You should make identified by the password when you are going to grant privileges like the following example which I did.. mysql> GRANT ALL PRIVILEGES ONE `*`.`*` TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF' WITH GRANT OPTION; Try this,I hope your problem will be solved.

Categories : Mysql

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

Scp fails in one direction for admin but is successful with root user
This looks like a known issue .bashrc and scp (excacly output from bash and non interactive shell). I solved this problem by modifying the part of .bashrc to execute only for interactive shell case $- in *i*) # interactive shell alias cc='clearCache.sh' echo 'Alias: cc - clear cache ;; esac Links to such problems: http://www.linuxquestions.org/questions/linux-server-73/strange-scp-error-and-fail-664945/ https://bugzilla.redhat.com/show_bug.cgi?id=20527 http://serverfault.com/questions/485487/use-bashrc-without-breaking-sftp

Categories : Misc

mysql grant remote permissions via non-root user
Well with root SSH access you can restart MySQL and tell it not to check for the root password by running (once MySQL has been stopped) 'sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &' then you could create a user and grant that user the grant_option.

Categories : Mysql

Devise in Rails redirects to root URL when editing user
Maybe this guide can help you https://github.com/plataformatec/devise/wiki/How-To:-Customize-the-redirect-after-a-user-edits-their-profile

Categories : Ruby On Rails

Access Denied for User 'root'@'localhost' (using password: YES) - No Privileges?
Use the instructions for resetting the root password - but instead of resetting the root password, we'll going to forcefully INSERT a record into the mysql.user table In the init file, use this instead INSERT INTO mysql.user (Host, User, Password) VALUES ('%', 'root', password('YOURPASSWORD')); GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION;

Categories : Mysql

can't generate core file after change user from root to nobody in c language
Read carefully core(5) man page: There are various circumstances in which a core dump file is not produced: .... skipping some text from the man page .... The process is executing a set-user-ID (set-group-ID) program that is owned by a user (group) other than the real user (group) ID of the process. So basically, after a successful setuid(2) syscall, core is not dumped.(for security reasons) See also the Linux specific prctl(2) syscall, with PR_SET_DUMPABLE. Read also http://advancedlinuxprogramming.com/ NB. Have a nobody writable directory is probably a bad idea. The nobody user should usually not own any file or directory!

Categories : C

How to make apache2 user to access the file in /root directory?
First, it is generally a bad idea to give apache access to root. If you insist ... Install ACL (Access Control List) Installing ACL Then, assuming your apache server runs with 'apache2' for it's user and group, give the apache2 user and group access to directories/files: setfacl -m "group:apache2:r-x" /root/whatever.file setfacl -m "user:apache2:r-x" /root/whatever.file # *** only need the next two lines if you plan on writing new files in the specified directory. It sets the default file permissions that will be used when the new file is created. setfacl -d -m "group:apache2:r-x" /root setfacl -d -m "user:apache2:r-x" /root Change the r-x permissions to whatever you need Edit - potential solution without ACL The following is untested and may require tweaking but should get you

Categories : PHP



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