w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to get rid off - sudo: /usr/lib/sudo/sudoers.so must be only be writable by owner sudo: fatal error, unable to load plugins
You have to login to root shell to resolve this sudoers.so permission issue. If you have root account login, directly login to root shell otherwise search something like "How do I boot into a root shell" or "Drop to root shell prompt". If you use Ubuntu you can follow this link http://askubuntu.com/questions/92556/how-do-i-boot-into-a-root-shell. Once you are in root shell change the permission of the file /usr/lib/sudo/sudoers.so to #chmod 644 /usr/lib/sudo/sudoers.so

Categories : Apache

php sudo shell_exec command runs from command line, but not from browser
Would it be out of the question to make a shell script that would run your command? #!/bin/sh sudo whoami in the php: $retVal = `/path/to/custom/script/myscript.sh &2>1`; if ($retVal) echo 'SWEET'; else echo 'POOP: ' . $retVal; {command} inside `` means the same as shell_exec('{command}') on a linux server. If I'm not way off base here your goal is to add users to your VPN (among other things perhaps) in which case you could pass command-line parameters for username/password/etc to your custom shell script. It's not exactly a pure shell_exec() answer to your question, but maybe you can run myscript.sh without doing sudo. Just basing this on the fact you said everything you tried worked in shell and path was set in echo $PATH, but not sudo echo $PATH in your PHP script. Seem

Categories : PHP

Repeat last command with "sudo"
You can write: sudo !! (See §9.3 "History Expansion" in the Bash Reference Manual.)

Categories : Bash

Execute tcl using sudo command
You can run tclsh (the “mothership” implementation of Tcl, written in C) from inside sudo just fine, or you can run a JVM which uses the TclJava library. However, sudo runs whole processes with elevated privileges and not just a library; you need to think in terms of creating a program that will do what you want, possibly with suitable arguments passed in. FWIW, I'd start by trying: sudo tclsh /path/of/my/script.tcl That's going to be the simplest if it works; it's how tclsh is designed to be used (plus sudo). It's only unsuitable if the script requires access to an in-process JVM. If that's the case, you're probably going to have to write a small wrapper Java program.

Categories : Java

How "sudo" command works?
man sudo would tell: Security policies may support credential caching to allow the user to run sudo again for a period of time without requiring authentication. The sudoers policy caches credentials for 15 minutes, unless overridden in sudoers(5). By running sudo with the -v option, a user can update the cached credentials without running a command. It also says: -k [command] When used alone, the -k (kill) option to sudo invalidates the user's cached credentials. The next time sudo is run a password will be required. This option does not require a password and was added to allow a user to revoke sudo permissions from a .logout file. Not all security policies support credentia

Categories : Linux

sudo command in Popen
sudo, ssh, sftp are all designed to know if there is a tty attached, so they ask for a password. The reason is that putting passwords in code is a big security violation. You can use the expect utility to run sudo or ssh and your python code, too... Use expect in bash script to provide password to SSH command

Categories : Python

Run sudo command with password
You can use the -S switch that reads password from stdin, example: ~$ echo "yourpassword" | sudo -S <command> Anyway, as @Thrustmaster said, this is not the right way to use sudo.

Categories : Linux

Error while using sudo command
I believe this might be the answer to your problem https://wiki.debian.org/sudo Specifically the second sentence of the second paragraph. Follow the steps there and see if that helps.

Categories : Mysql

Detecting if a command is executable by sudo
On Linux, on (at least) Debian-like systems, you can have a look at /etc/sudoers (and the optional /etc/sudoers.d/* files, if created, and included in the main /etc/sudoers) that give (among others) the search path to where (which dir) a command can be issued the sudo user (root) privileges groups who can use sudo and their privileges This is the sudoers man page for more information.

Categories : Shell

QT application rights for sudo command
Just searching around for "elevate privileges" in linux, this is what I found. Best way elevate the privileges programmatically under different versions of Linux? With an answer that pointed me here: http://en.wikipedia.org/wiki/PolicyKit http://www.freedesktop.org/wiki/Software/polkit/ Hope that helps.

Categories : C++

execute a sudo command with in a C/C++ Program
Another option is to execute sudo commands without a password. To do that you can open the file /etc/sudoers with your favourite editor and add this line at the end. Remember to change the yourname with the user name. yourname ALL = (ALL) NOPASSWD: ALL

Categories : C++

Validate password in sudo command
Tell sudo to read the password from standard input using the -S option, and to not take into account cached credentials from previous authentications using the -k option. Also, you should be able to just use a pipe directly without the need to spawn a new shell. So just do: echo password | sudo -k -S -u username command/script There's a few things to note. First, most systems have configured sudo in a way to take the current user's password, not the target user's one. To configure sudo to read the target user's password instead, you must set: Defaults targetpw In your sudo configuration (/etc/sudoers or a file in /etc/sudoers.d/).

Categories : Linux

How to use forever-node with sudo command?
sudo forever start server.js should work. Alternatively, >>> sudo su >>> cd /folder/of/script >>> forever start server.js

Categories : Javascript

How can i run a sudo command in Bash script?
You shouldn't pass username and password. This is not secure and it is not going to work if the password is changed. You can use this: gksudo kinit # This is going to open a dialog asking for the password. #sudo kinit # or this if you want to type your password in the terminal vi hello.txt Or you can run your script under root. But note that vi is going to be ran as root as well, which means that it will probably create files that belong to root, that might be not what you want.

Categories : Bash

Sudo without password to run dd command Python
As mentioned in the comments of your previous question, you need to add to your sudoers file like this for the sake of simplicity just turn off the passwords and you will be able to run this without a password admin ALL = NOPASSWD: ALL the file will be found in /etc/sudoers Then your python script will run fine and not require a password Here is a tutorial on how to use visudo which is what you will need to use to edit sudo password settings

Categories : Python

ubuntu - sudo pecl command not found
Find your instance of pecl. i.e. which or locate Check for secure_path on sudo [root@host ~]# sudo -V | grep 'Value to override' Value to override user's $PATH with: /sbin:/bin:/usr/sbin:/usr/bin If $PATH is being overriden us visudo and edit /etc/sudoers and append the path to pecl Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin

Categories : Ubuntu

running a sudo command from supervisord with the '-E' switch
You should not need to use the sudo program from inside supervisord, supervisord can already set the correct uid for each process, using the user paramenter in the [program:x] section. supervisord also takes care of setting the correct environment for each process group using the environment option in the same section. For a pretty concise example of exactly this, see the config in this bit of documentation: http://supervisord.org/subprocess.html#subprocess-environment

Categories : Python

-bash: sudo: command not found Mac OS X (EC2 CLI prob?)
As stated in the comments the right files to set up your $PATH variable are: ~/.profile or ~/.bash_profile export PATH=/usr/bin:/usr/sbin:/bin:/usr/local/bin:/sbin:/opt/x11/bin:$PATH In this way when you re-enter in the console your PATH will work fine. You can add other directories to your $PATH as you like. If you just copy and past that line in an active console you just set the PATH variable temporary, when you logout and login again you will loose your path, so add it in your ~/.bashrc file.

Categories : Osx

sudo: port: command not found after updating .bash_profile
You are missing a leading backslash: /opt/local - not opt/local The automated annotations from a MacPorts install always prepended the following directories for me: export PATH=/opt/local/bin:/opt/local/sbin:$PATH, in .profile. i.e., the port binaries should take precedence over the system, or whatever else you have in your current PATH.

Categories : Osx

How to execute bash command with sudo privileges in Java?
I think you can use this, but I'm a bit hesitant to post it. So I'll just say: Use this at your own risk, not recommended, don't sue me, etc... public static void main(String[] args) throws IOException { String[] cmd = {"/bin/bash","-c","echo password| sudo -S ls"}; Process pb = Runtime.getRuntime().exec(cmd); String line; BufferedReader input = new BufferedReader(new InputStreamReader(pb.getInputStream())); while ((line = input.readLine()) != null) { System.out.println(line); } input.close(); }

Categories : Java

Unexpected output found while executing sudo command
When you execute it in the shell, the shell splits the command line according to normal shell rules, i.e. you get "execute echo with parameter <password>, pipe the result to sudo ...". Java doesn't use the shell, so you're getting "execute echo with parameter <password> | sudo -u root -S ls".

Categories : Java

decide page based on number of parameters - htaccess url rewrite
Done, for anyone else who need this too... RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?userId=$1 [L] RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?userId=$1 [L] RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ category.php?userId=$1&category=$2 [L] RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ category.php?userId=$1&category=$2 [L]

Categories : Htaccess

How to decide on what unit tests to create for a rules-based system
You need tests for your parser. For a given input string, make sure the correct rule object comes out. This does not access files, because your parser should not be tightly coupled to file I/O. You need tests for every rule. Make sure the rule gives the results you want it to for given packets. This is probably the most important part; be sure to test edge cases thoroughly. You don't want any of these rules to misbehave, because they will be bombarded by malicious input. And you need tests for the rule system. Write simple test rules and use them to make sure that the rule system correctly dispatches packets and acts on the responses. All of these can easily be written before the actual code.

Categories : C++

sudo: effective uid is not 0, is sudo installed setuid root?
Your sudo binary doesn't have the setuid flag, as it correctly guessed. As root, try: chmod u+s /usr/bin/sudo OSX users: To everyone landing here from search engines: this is not the way to fix the OSX system that you broke. The question is Linux oriented - hint, lxc tag - and that is what this answer is for. The answer provided by Gustavo Matias might help :-)

Categories : Misc

why the "open" command runs under the home directory?
I am a ubuntu Linux user but I'm pretty sure the cli is very similar for both. Anyways, I believe the default directory when you open a new terminal window is your home directory. Unless you change it within your settings. This is the likely reason for the pwd command in "b" printing your home directory.

Categories : Osx

Home brew failing on “command ‘gcc’ failed with exit status 1″ error
I found a workaround on SO, I can't find the original post but similar info is given on this one : Installing Scipy on Mac OS X Lion 10.7.5 So I added the following lines to my .bashrc and I then managed to brew install gdal. export CC=gcc export CXX=g++ Be aware that this did not solved my problem entirely as I still have config issue with geodjango, but at least I have gdal installed.

Categories : Gcc

How can I change the home page of a site in Orchard CMS based on rules such as the time of day, or the visitor's device?
The easiest way would be to override the route for "/" to point to your custom controller. Make decision there and either perform a redirect, transfer the request or return varying results. It could also be done on a lower level but this is way more complicated (using custom route implementation, route handler etc. - similar to what Orchard.Alias module does). Extending Orchard.Alias to take into account custom logic in addition to or replacing the current simple path-matching logic would be a way to go then.

Categories : C#

How can I make my routes that start with /home always direct to the home controller and index action?
Sure, just remove the {action} part from your route definition so that the action is always Index: routes.MapRoute( name: "Default", url: "home/{anything}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } );

Categories : Asp Net Mvc

MVC image folder not accessible from Home/Contact but visible from Home/Index in _Layouts.cshtml
It has to do with the relative path to images folder. You likely have Index action and Home controller as default parameter values in a Default route. Therefore, the url that will invoke this action probably does not have controller and action included. Assuming that images folder is in website root directory, the relative path images takes us to the correct location. In case of Home/Contact url, same relative path would mean Home/Contact/images folder which does not exist. Use: <img src="<%= Url.Content("~/[path to images dir from website root dir (usually - content)]/images/logo.png") %>" ... Realized that you use Razor: <img src="@Url.Content("~/content/images/logo.png")" ...

Categories : Image

How do you create a transparent activity that can overlay the home screen but is not dismissed when the home or back button is pressed?
You can create a transparent activity with the help of 1.Make the background of layout in your xml file transparent by using android:background="@android:color/transparent" 2.And also,make the theme in your manifest file transparent for that particular acitivity <activity android:name="Your activity" android:label="@string/app_name" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" > </activity> 3.And for back press over ride OnBackPressed() Method and remove super.onBackPressed() @Override public void onBackPressed() { // TODO Auto-generated method stub }

Categories : Android

Using routes to link to home/subpage/THIS instead of home/THIS
You should use resources_entrepreneurship_path. Note the _ instead of the /. Also, you can nest routes inside a namespace like this: namespace 'resources' do get 'entrepreneurship', to: 'static_pages#entrepreneurship' end

Categories : HTML

SQL command based on PHP strstr or LIKE
You're using strstr in the same manner as substr, where the string contains ABC. SELECT * FROM table WHERE Date > :FromDate AND Date < :EndDate AND col1 LIKE '%$string%'; If you want to search for a string where the first characters are ABC, use: SELECT * FROM table WHERE Date > :FromDate AND Date < :EndDate AND col1 LIKE '$string%'; stristr, however, would be a different story altogether.

Categories : PHP

Interacting with windows messages with command based compiler
To use GetMessage or PeekMessage you don't need any windows in your thread: http://msdn.microsoft.com/en-us/library/ms644946%28v=vs.85%29.aspx The thread to which the message is posted must have created a message queue, or else the call to PostThreadMessage fails. Use the following method to handle this situation. Create an event object, then create the thread. Use the WaitForSingleObject function to wait for the event to be set to the signaled state before calling PostThreadMessage. In the thread to which the message will be posted, call PeekMessage as shown here to force the system to create the message queue: PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE) > Set the event, to indicate that the thread is ready to receive posted

Categories : C

Custom Home Screen with the properties like default Home Screen
The Android 4.x stock home screen uses a series of GridView widgets in a ViewPager, near as I can tell. You might be able to tell more by using Hierarchy View or uiautomatorviewer to inspect the UI of home screen.

Categories : Android

How does Git decide on conflicts?
Git has an internal merge system that is independent of difftool. Anyway you can specify the merge strategy using the -s option, from the manual: -s <strategy> --strategy=<strategy> Use the given merge strategy; can be supplied more than once to specify them in the order they should be tried. If there is no -s option, a built-in list of strategies is used instead (git merge-recursive when merging a single head, git merge-octopus otherwise). Strategies go from the simple FastForward to the Octopus when merging a lot of trees. Check this asnwer to see how the different merge strategies work. Anyway your scenario is weird. Maybe your IDE is using a different merge strategy, so when it opens it does the merge the right way.

Categories : GIT

Adding modifier-based keyboard shortcuts to a Ruby command-line application
Install highline gem - should permit you to trap all kinds of key combinations (without requiring the user to press enter after the key). See this question for some more detail: How to get a single character without pressing enter? If you do use highline, at least in my testing, you may (or may not) be able to use Kernel.trap to grab key events like Ctrl-C so you should handle those manually. Highline will trap any key and let you detect ctrl-d vs d. It won't detect the difference between ctrl-d and ctrl-shift-d however, nor does it distinguish alt-d from d. Here's some basic code: require "highline/system_extensions" include HighLine::SystemExtensions print "Press any key:" k = get_character Kernel.abort(" Ctrl-C - exiting.. ") if k == 3 puts puts k.chr

Categories : Ruby

Need help to decide a game strategy
The logic you use is wrong: M -> Mine 1 = 1 coal unit(s) B -> Mine 1 = 2 " M -> Mine 2 = 1 " F -> Mine 1 = 3 " F -> Mine 2 = 2 " B -> Mine 2 = 3 " Since for the first day, Mine 1 only had 1 type of food. I can see a simple dynamic programming algorithm, but I'll leave that to you. A simple hint: for each shipment, you can send it to either mine 1 or 2; after sending it, what matters is just: The amount of mine that has been mined; The previous 3 shipments. So there are at most (3 ^ 3) ^ 2 = 729 shipment configurations, and for each of these an optimal amount of coal. In each step compute these configurations, and in the end you will get the answer.

Categories : Algorithm

How to dynamically decide what to cache
There is no way to teach a program - not an easy - to know what is important to be cached now and what is not. This should be decided by the architect or engineer. Because only he knows what should be cached. If you do not know what has to be cached, you should better study the domain of your application and observe her behavior. Anyway, to teach a program, what it should cache, you should know what cache before. The application must know the popularity of data, as you said. So, the application knows what cache.

Categories : PHP

I can't decide how to structure my table
Store each field in the form in a separate column in the database table, with each form submission being a row. This is how it's intended to work and is by far the simplest, best and most flexible solution. Don't make simple things complex unless you have no other choice. Packing and unpacking/parsing strings, storing XML in the database - all possible, but far too complicated for something simple like this - unless there's something that you're not telling us? Anyway, basically, if your form looked like this: Name* [ ] Phone* [ ] Then your table would look something like this: CREATE TABLE IF NOT EXISTS `form_submissions` ( `submission_id` INT NOT NULL , `name` TEXT NOT NULL , `phone` TEXT NOT NULL , PRIMARY KEY (`submission_id`) ) ; Keep it sim

Categories : SQL

Decide When to Use ConfigureAwait(false)
Any code that directly (or indirectly) manipulates UI elements should be run in the UI context. Usually, this just includes direct manipulation and updating ViewModels. In all other situations, you should use ConfigureAwait(false).

Categories : C#



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