Unable to edit files as admin user

Discussion in 'HOWTO-Related Questions' started by Happy, Jul 8, 2010.

  1. Happy

    Happy New Member

    I installed the following dist for system users only The_Perfect_Server_-_Ubuntu_Lucid_Lynx_(Ubuntu_10_04)_[ISPConfig_2]
    Here is a problem I am running into:
    I don't allow root to ssh in to my mail server. I log in with another admin ID and do sudo su. However, anytime I try to run the commands below I get and error about not being able to edit a read only file.

    vi /etc/postfix/virtusertable

    /etc/init.d/postfix restart


    The only workaround I have found is to add my admin user ID to the root group or to allow root to ssh and run the commands. When lookink at the file system it shows root as the owner of the files I believe
     
  2. falko

    falko Super Moderator Howtoforge Staff

    What's the output of
    Code:
    whoami
    when you get that error? What's the output of
    Code:
    ls -la /etc/postfix/
    ?
     
  3. Happy

    Happy New Member

    What's the output of
    Code:
    ---------
    whoami

    administrator

    when you get that error? W10: Warning : Changing a readonly file

    What's the output of
    Code:
    ---------
    ls -la /etc/postfix/
    ---------
    total 108
    drwxr-xr-x 4 root root 4096 2010-07-06 09:52 .
    drwxr-xr-x 88 root root 4096 2010-07-06 17:23 ..
    -rw-r--r-- 1 root root 318 2010-06-28 16:35 dynamicmaps.cf
    -rw-r--r-- 1 root root 72 2010-06-28 17:35 local-host-names
    -rw-r--r-- 1 root root 1841 2010-06-28 17:51 main.cf
    -rw-r--r-- 1 root root 5301 2010-06-28 16:35 master.cf
    -rw-r--r-- 1 root root 18992 2010-02-18 00:38 postfix-files
    -rwxr-xr-x 1 root root 8729 2010-02-18 00:38 postfix-script
    -rwxr-xr-x 1 root root 24256 2010-02-18 00:38 post-install
    drwxr-xr-x 2 root root 4096 2010-06-28 16:40 sasl
    drwxr-xr-x 2 root root 4096 2010-06-28 16:44 ssl
    -rw-r--r-- 1 root root 395 2010-07-06 09:51 virtusertable
    -rw-r--r-- 1 root root 12288 2010-06-28 17:51 virtusertable.db


    I also can't run these commands as administrator
    postmap /etc/postfix/virtusertable
    /etc/init.d/postfix restart

    I know that root is the owner. Do I need to change the owner of these files and if so how? I am also unable to reboot system as administrator



    Thanks
     
  4. falko

    falko Super Moderator Howtoforge Staff

    It should show root after you run
    Code:
    sudo su
    Does sudo su show any errors?
     
  5. Happy

    Happy New Member

    Not sure what logs to look in for the errors if there are any? As far as errors when I run the command sudo su and input my password. It seems to look normal.
     
  6. falko

    falko Super Moderator Howtoforge Staff

    I'd enable the root account. You can disable direct root logins in SSH for security reasons so that you have to use su to become root.
     
  7. Happy

    Happy New Member

    ok I have always had root enabled. I did disable ssh for root. My question is how do I eleveate to root since I disabled ssh for root?
     
  8. learnbash

    learnbash New Member


    I think you are asking about.

    Code:
      sudo su - 
     
  9. falko

    falko Super Moderator Howtoforge Staff

    Log in as a normal user and the run
    Code:
    su
     
  10. Happy

    Happy New Member

    ok let's say my administrator user login is joe, not administrator. after ssh into box I ran the command sudo -l and it said my user joe had all rights. However, I still can't edit files owned by root. Any ideas?I don't want to enable my root account to ssh in

    Thanks
     
  11. falko

    falko Super Moderator Howtoforge Staff

    Please use su!
     

Share This Page