Results 1 to 5 of 5

Thread: how to edit sshd_config?

  1. #1
    Join Date
    Nov 2009
    Beans
    6

    how to edit sshd_config?

    I want to edit sshd_config to make my machine accesible remotely using ssh. however when i open it in gedit, it is Read-only.
    How do i make it editable and then make a change.
    When i navigate to that file, it says that i am not the owner and cannot change the permissions.

    I am logged in the ubuntu desktop as root user and dunno how to fix this.
    please help.

  2. #2
    Join Date
    May 2010
    Location
    uk
    Beans
    9,249
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: how to edit sshd_config?

    Hi

    I am logged in the ubuntu desktop as root user and dunno how to fix this.
    There is no need to do this and it is a security risk.

    Log in as a user with admin (sudo) privileges and type this to run gedit with admin rights.

    Code:
    pkexec gedit /etc/ssh/sshd_config
    You can also use the terminal and nano.

    Code:
    sudo nano /etc/ssh/sshd_config
    Kind regards
    If you believe everything you read, you better not read. ~ Japanese Proverb

    If you don't read the newspaper, you're uninformed. If you read the newspaper, you're mis-informed. - Mark Twain

    Thinking about becoming an Ubuntu Member?

  3. #3
    Join Date
    Mar 2011
    Location
    19th Hole
    Beans
    Hidden!
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: how to edit sshd_config?

    Are you sure pkexec works with gedit out of the box? Mine doesn't (14.04). Had to install this gedit policy in policykit to make it work.

  4. #4
    Join Date
    May 2010
    Location
    uk
    Beans
    9,249
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: how to edit sshd_config?

    Hi

    Quote Originally Posted by DuckHook View Post
    Are you sure pkexec works with gedit out of the box? Mine doesn't (14.04). Had to install this gedit policy in policykit to make it work.
    Thanks for the info.

    It's been a while since i used vanilla Ubuntu so... and i mostly use the terminal for editing configuration files.

    Kind regards
    If you believe everything you read, you better not read. ~ Japanese Proverb

    If you don't read the newspaper, you're uninformed. If you read the newspaper, you're mis-informed. - Mark Twain

    Thinking about becoming an Ubuntu Member?

  5. #5
    Join Date
    Mar 2011
    Location
    19th Hole
    Beans
    Hidden!
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: how to edit sshd_config?

    Quote Originally Posted by matt_symes View Post
    ...Thanks for the info.
    My pleasure. Always happy if I can help.
    It's been a while since i used vanilla Ubuntu so... and i mostly use the terminal for editing configuration files.
    This whole issue/problem/mess with the question of properly invoking a root gedit coincidentally was raised by TheFu in this recent thread. In summary, recent versions of Ubuntu have deprecated gksudo, which isn't even installed by default anymore. Yet, no polkit policy exists for gedit or nautilus either, so pkexec doesn't work. New users are either forced to use command line tools, which I contend (in the aforementioned thread) will just drive them away, or to invoke graphical tools using various workarounds, one of which is installing the missing policies. A superficially less complicated option is:
    Code:
    sudo -H gedit file_name
    or
    Code:
    sudo -i nautilus
    ...though I find the use of sudo with flags too murky for the new user to get their head around. Unless one is familiar with the guts of the OS, it seems superfluous to use the -H flag for graphical apps when it isn't needed for CLI counterparts.

    I hope the developers change their minds and install policies for gedit, nautilus, zenity, etc in upcoming releases. Until then, we will just have to continue wrestling with the quandary of how to advise new users every time a config file needs changing.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •