Why doesn't `sudo cd /var/named` work?

0 0
First, "export" is a "shell built-in", not a "command". "sudo" runs commands. That's why it can't find a command when you try to "sudo export".

Using "sudo" before a command gives it absolute power over your machine, including the power to completely destroy everything on your hard drive or worse. It's a bad idea to use "sudo" unless you're absolutely sure you know what you're doing or you completely trust the source that told you to type it in. With great power comes great responsibility, so "sudo" is a very powerful and dangerous command and is not to be used lightly.

Back to bash:

Yes, "export" only takes effect for the shell session in which it's run, so the computer needs to run that "export" every time you open a new shell session. That's where the .bash_profile comes in. "bash" is a "shell". The ".bash_profile" file is a list of tasks that every new bash shell session should perform when you open it.

"PATH" is a shell environment variable that tells your...

0 0
0 0
Nov 7, 2010

I am trying to edit a postinfo.xsl in my root file dir, and with the command:

frank@linux-avnb:~> sudo gedit

(gedit:14150): Gtk-WARNING **: cannot open display: frank@linux-avnb:~>

I get the following. what am i doing wrong?

OpenSUSE :: Gedit With Sudo - (gedit:7137): Gtk-WARNING : Cannot Open Display General :: Why Doesn't 'sudo Gedit' Work In Vinagre Ubuntu :: Installing Explorer - Command Gedit User.reg (gedit:2573): Gtk-WARNING ** Cannot Open Display OpenSUSE :: Using Gedit As Root: Gtk-WARNING **: Cannot Open Display OpenSUSE :: Sudo And Graphic Apps Not Working - Can't Open Display: :0.0 From /etc/sudoers Ubuntu :: Can't Open Sudo Gedit /etc/X11/xorg.conf - What's Wrong? CentOS 5 :: Can't Open Cpp Files In Gedit - Couldn't Display ? Software :: Gedit Uses In Root - Doesn't Open File Software :: Gedit Elastic Tabstops Plugin Doesn't Work OpenSUSE :: Set The Option 'Double Click To Open Files And Folders' But It Doesn't Seem To...
0 0
0 0

If you use sudo to run commands as root, you've probably run into “permission denied” problems when only part of a pipeline or part of a command is running with root permissions.

This fails with “permission denied” because the file is writable only by root:

$ echo 12000 > /proc/sys/vm/dirty_writeback_centisecs

But, this fails too:

$ sudo echo 12000 > /proc/sys/vm/dirty_writeback_centisecs

Why? The /bin/echo program is running as root, because of sudo, but the shell that's redirecting echo's output to the root-only file is still running as you. Your current shell does the redirection before sudo starts.

The solution is to run the whole pipeline under sudo. There are a couple ways to do it, but I prefer:

echo "echo 12000 > /proc/sys/vm/dirty_writeback_centisecs" | sudo sh

That way, I can type everything before the pipe character, and see what I'm about to run as root, then press the up arrow and add the | sudo sh to do it for real. This is not a big...

0 0

This what happens after I changed to /usr/bin/sudo:

[root@abigail native]# service tomcat start
sudo: tomcat: command not found

My current session user ID abigial. After I exit from 'root' and execute the command again. I got:

[abigail@abigail ~]$ service tomcat start
[sudo] password for abigail:

It still asks a password. Then I tried my login password for the user 'abigial', then I got:

[abigail@abigail ~]$ service tomcat start
[sudo] password for abigail:
"abigail is not in the sudoers file. This incident will be reported.

I am puzzled. My understanding is that I should be able to start tomcat service with either "root" or "abigail", without using a password.

What's the problem?...

0 0
0 0
Hello Chuck,

The problem with the "cd" command is, that it is a "built in command".
Tha means it is provided directly by your shell. Most of the programs
you run are programs loaded from executable files e.g. the "cp"
coommand. (Which resides at /bin/cp). For "cd" there is no executable
binary or executable script.

The "sudo" command expects a command which is a "real" program with an
executable file. "sudo" starts the other program - and gives it it's
arguments - with the rights of the superuser / root. So you can use it
to do things your normal user isn't allowed to. But this doesn't affect
your command line. When the programm you executed with sudo has exited
or switched to running in the background then you are back on the
command line, just the "normal user" you are.

I suppose you want to change dir into a directory your user has no
access to. Giving you a short advice how to work around this with "sudo"

0 0

If you try to use sudo to get to a directory (for instance if the user calling sudo don’t have permissions for that folder) then you will see an error message like this

While I don’t know how to get sudo to work with cd I can offer some workarounds.
As far as I can tell the problem with sudo cd is that if it would have worked the user would be in a directory that he/she has no permissions to so nothing is gained and having a folder that the user don’t have permissions to as the working directory might cause problems in more way than one.

Use “sudo ls” and then continue with the next command as sudo without entering that folder; for instance Open a shell using sudo:

this will give you a shell with su permissions

simulate initial login using sudo:

this will also give you su permissions but with the difference that it will be like logging in like root (home dir, profile, variables etc) [this would be equivalent of running “sudo su”]

Use sudo to...
0 0

It's also worth remembering that, cd's status as a shell builtin or external binary notwithstanding, sudo works by spawning a new process to run the command specified.

Why is this important? Because the basic execution flow of sudo becomes something very similar to this:

The shell spawns off a subprocess to run sudo with the given parameters sudo authenticates the user and confirms their right to execute the specified command sudo spawns off a subprocess to execute the specified command sudo waits for the subprocess spawned off in step 3 to exit sudo exits, returning to the shell The subprocess spawed in step 1 exits, returning the user to the shell prompt

(This may be technically slightly incorrect; there is a system call which actually replaces the running process with a new one (that's the C library's execve()). However, for the purposes of this explanation, the two are equivalent.)

This becomes important when you consider that the current working...

0 0

Inspired by this horror story of an install, I've decided to see if there's a more elegant way of getting it done. I *think* I have it, but the root cause may make this fix moot.

The problem that needs to be addressed is that the dependencies listed in the .deb files provided by Codership for installing the patched mysql binaries and Galera don't line up properly with packages that you can install in Ubuntu. The version provided by Codership is based on MySQL 5.6.16, where as the repositories are up to 5.6.19. This particular problem isn't exactly unexpected due to the nature of what's being installed: A patch to MySQL.

Before you go any further, I must state the following: I have not analyzed the impact of this procedure with great depth. All I know is that initial testing indicates that there's no problem with it, but there is a reality that cannot be denied: There might be a version mis-match with some of the binary files. Until Codership delivers a version of...

0 0

This directory tree contains all the configuration files for the X Window System. Users should note that many of the files located in this directory are actually symbolic links to the /usr/X11R6 directory tree. Thus, the presence of these files in these locations can not be certain.

/etc/X11/XF86Config, /etc/X11/XF86Config-4

The 'X' configuration file. Most modern distributions possess hardware autodetection systems that enable automatic creation of a valid file. Should autodetection fail a configuration file can also be created manually provided that you have sufficient knowledge about your system. It would be considered prudent not to attempt to type out a file from beginning to end. Rather, use common configuration utilities such as xf86config, XF86Setup and xf86cfg to create a workable template. Then, using suitable documentation commence optimization through intuition and/or trial and error. Options that can be configured via this file include X...

0 0
0 0