Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I know this sounds really stupid, but each time I try to edit a configuration file it is usually a "(read only)" and I get a message saying "permission denied" when i try to change it in gedit. So how does one obtain permission to edit these files?
You need to su to root before editing a file (such as in the /etc directory).
Then enter the password.
If you are using a GUI editor program like kwrite, for example, then enter 'kdesu kwrite' to start the editor. You can enter it in the 'application launcher' or by launching the 'Run Command...' menu item.
An exception would be the 'sudoers' file. You need to run the 'visudo' program to edit this file.
Originally posted by Virp00 I know this sounds really stupid, but each time I try to edit a configuration file it is usually a "(read only)" and I get a message saying "permission denied" when i try to change it in gedit. So how does one obtain permission to edit these files?
One thing that separates Linux from some other unsecure
OSes is the Unix tradition of multiple users.
You should have and use a normal user account, which only
has access to edit files in /home/<username> and run your
system logged in as that normal user. Only su to root when
you must do system administration.
To edit them as root, you can open a terminal, and then
either su to root, or issue something like this:
mingdao@james:~$ su -c "gedit /etc/lilo.conf"
which will launch gedit as root user, but when you save
the file and close gedit, you will not be logged in as root.
For more information issue and read
mingdao@james:~$ man su
Originally posted by Virp00 ok, so do I enter "su" then the name of the file I want to edit?
Issue "man su" without quotes to read the manual page.
When you issue "su" you switch users, and if you only have
a normal user and root, and you're logged in as the normal
user, it "switches to root" by default.
If you issue it like my example of
$ su -c "gedit /etc/lilo.conf"
the c switch changes the next statement to a command, so
that your system opens your filename with gedit (my example)
and you edit it as root; but when you close the program, and
stop the command, the terminal is returned to a normal user.
Therefore, you're not logged into or running your system as
the root user.
Which files do you want to edit? Perhaps if you'll share that
with us, we might know another (even better) answer to give...
Distribution: K/Ubuntu 12.04/14.04, Scientific Linux 6.3/6.4, Android-x86, Pretty much all distros at one point...
The su command is the "switch user" command.
You want to type:
You will be prompted for your root password. Once you do, you will have console command to do whatever you want.
However, if you are attempting to do this graphically, I'd use;
in the run box under your KDE menu,
Then enter your root password,
Then right click on the file and edit with kwrite,
That assumes you use KDE as your primary window manager.
Thanks. I was able to edit the file. However I have one question; after I entered the command, I got this message:
" GnomeUI-WARNING **: While connecting to session manager:
Authentication Rejected, reason : None of the authentication protocols specified are supported and host-based authentication failed.
*** attempt to put segment in horiz list twice"
Different distro's have different settings for security. On mandrake, you can su to root and start a graphic program such as gedit or kwrite. Things are set up in PAM such that xauth is used to send a ticket allowing the use of the X windows when su'ed to root. On SuSE, it will refuse to do this. I don't remember all of the hairy details, but you just need to know that there are different security policies between different distributions of linux.
On both, you can simply start the application using 'kdesu'. A requester will come up asking for the root password.
There is another way of doing it in the future, that you may find handy. Suppose that you want to easily start up 'kwrite' as root to edit configuration files.
You can drag the 'kwrite' icon from the menu onto the task bar. Then right click on your task-bar kwrite icon and select properties. Click on the 'Application' tab. Select the 'Advanced Options...' button. In the middle area, click on the 'Run as a different user button, and enter 'root' as the 'Username'. Now in the future, clicking on the task-bar icon will bring up the dialog to enter the root password, and then start the program.