![]() ![]() This way you know you are running a non-standard install or custom version. Or even alias localemacs='/home/user1/local_build/bin/emacs' I don't know why you have emacs in the users folder, so I have included this option.Īnother option is to change the alias for Option 3 to something more custom like: alias emacsuser1='/home/user1/local_build/bin/emacs' It is also possible that root does not use the bash shell. ![]() Option 3 is not recommended (in my opinion) as it it starting to create a real mess of your system. If /root/.bashrc does not exist, just create it. This alias should be added to both /home/user1/.bashrc and /root/.bashrc. For example: sudo /home/user1/local_build/bin/emacsĪdd the following alias: alias emacs='/home/user1/local_build/bin/emacs' If the file is not found, gedit will open a blank file with the file name entered on the command line: To open a specific file: gedit filename To open multiple files: gedit file1 file2 To edit system files such as sources. Use the full path when running emacs - as pointed out in the answer by 7_R3X. Since I upgraded to Linux Mint 18.2, it prompts for the password, and does nothing when I enter the correct password. Do not use a users folder to store applications you expect to be accessible to root. by jez9999 Sun 2:44 pm The comment 'gksu gedit' used to work, prompt me for a password, and run gedit as root so I could edit files that needed root access. ![]() Install emacs to /usr/local/bin - the correct location. This means you need a non-standard solution. Either amended it or create a new alias would be my suggestion.Įdit 3: You are doing non-standard stuff, that is installing emacs in a users folder, then expecting to be able to execute it as root. You need to check ~/.bashrc or ~/.profile for that user. If you are trying to run as the root user, what happens when you try: suĮdit 2: That alias is the issue. If you check what type emacs or command -v emacs says then your problem would be solved. Why emacs does not get launch using sudo?Īt the core of the issue is which. # ls -ltr /etc/sudoers #Unable to modify this file # alias emacs='emacs -q -load ~/.emacs.d/init.el' I have appended PATH for root user, just now $ whoamiĮxport PATH=/home/user1/local_build/bin:$PATHĪlias emacs='emacs -q -load ~/.emacs.d/init.el'Īfter an answer from Tigger, problem still exists, $ tail -n 2 -F /home/user1/.bashrc $ emacs /etc/apache2/sites-available/nf # Works fine The directory where foo.sh resides is not present in the PATH variable of the root user, hence the command not found error.$ sudo emacs /etc/apache2/sites-available/nf Note that, although similar, in this case the directories contained in the PATH the non-privileged user (rkielty) and the super user are not the same. PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin Here's some sample output of running the above env command first as an ordinary user and then as the root user using sudo env | grep sudo env | grep ^PATH To see what it is set to run env | grep ^PATH otherwise install it with sudo apt install gedit - if you install it with. Each user sets their own PATH variable according to their needs. You should not be using anything outside of the VM while working on The Odin. The PATH environment variable contains a list of directories which are searched for commands. The reason that the root user is not finding your command is likely that the PATH environment variable for root does not include the directory where foo.sh is located. When you run a command using sudo you are effectively running it as the superuser or root. ![]() rwxr-xr-x 1 rkielty users 0 14:47 foo.shįoo.sh is now executable as far as Linux is concerned. $ ls -l foo.sh # Now we see an x after the rw (Group and other only have read permission set on the file, they cannot write to it or execute it) $ chmod +x foo.sh # The owner can set the executable permission on foo.sh Owner has read and write access rw but the - indicates that the executable permission is missing $ ls -l foo.sh # Check file permissions of foo Here's a summary of how to troubleshoot the Permission Denied error in your case. which will list the READ, WRITE and EXECUTE permissions for the file owner, the group owner and everyone else who is not the file owner or a member of the group to which the file belongs (that last permission group is sometimes referred to as "world" or "other") Once read and understood you should be able to understand the output of running. To read the chmod documentation for your local system, run man chmod or info chmod from the command line. chmod, an abbreviation of change mode, is the command that is used to change the permission settings of a file. In order to fully understand Linux file permissions you can study the documentation for the chmod command. pkexec env DISPLAYDISPLAY XAUTHORITYXAUTHORITY gedit will not get you. In order to run a script the file must have an executable permission bit set. Starting from Ubuntu 17.10 the gksu and gksudo commands have dissapeared from. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |