Why am I root? (accessing sftp server with pubkeys)


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Why am I root? (accessing sftp server with pubkeys)
# 1  
Old 09-01-2014
Why am I root? (accessing sftp server with pubkeys)

Hi,

It is my first post here - I am Krzysztof Image

I have configured my linux based server (it is Synology DS1813+) to be accessible only via SSH and only with public certificates (my /etc/ssh/sshd_conf below).

Both login into shell and sftp work well, but if I access the server via sftp (for example via standard gnome file manager - Connect to Server ) I have root permissions even though I login as a regular user (the user has admin rights but it definitely is not root).

Does anybody know why am I root and not the user I login as?

Thanx in advance for any suggestions
K.


Code:
    #   $OpenBSD: sshd_config,v 1.82 2010/09/06 17:10:19 naddy Exp $

    # This is the sshd server system-wide configuration file.  See
    # sshd_config(5) for more information.

    # This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

    # The strategy used for options in the default sshd_config shipped with
    # OpenSSH is to specify options with their default value where
    # possible, but leave them commented.  Uncommented options change a
    # default value.

    Port 22
    AddressFamily inet
    ListenAddress 0.0.0.0
    #ListenAddress ::

    # The default requires explicit activation of protocol 1
    Protocol 2

    # HostKey for protocol version 1
    #HostKey /etc/ssh/ssh_host_key
    # HostKeys for protocol version 2
    #HostKey /etc/ssh/ssh_host_rsa_key
    HostKey /etc/ssh/ssh_host_dsa_key
    #HostKey /etc/ssh/ssh_host_ecdsa_key

    # Lifetime and size of ephemeral version 1 server key
    #KeyRegenerationInterval 1h
    #ServerKeyBits 1024

    # Logging
    # obsoletes QuietMode and FascistLogging
    #SyslogFacility AUTH
    #LogLevel INFO

    # Authentication:

    LoginGraceTime 2m
    PermitRootLogin no
    #StrictModes yes
    MaxAuthTries 3
    #MaxSessions 10

    RSAAuthentication no
    PasswordAuthentication no
    UsePAM no
     
    PubkeyAuthentication yes
    AuthorizedKeysFile   .ssh/authorized_keys

    # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
    #RhostsRSAAuthentication no
    # similar for protocol version 2
    #HostbasedAuthentication no
    # Change to yes if you don't trust ~/.ssh/known_hosts for
    # RhostsRSAAuthentication and HostbasedAuthentication
    #IgnoreUserKnownHosts no
    # Don't read the user's ~/.rhosts and ~/.shosts files
    #IgnoreRhosts yes

    # To disable tunneled clear text passwords, change to no here!
    #PasswordAuthentication yes
    #PermitEmptyPasswords no

    # Change to no to disable s/key passwords
    #ChallengeResponseAuthentication yes
    ChallengeResponseAuthentication no

    # Kerberos options
    KerberosAuthentication no
    GSSAPIAuthentication no
    #KerberosOrLocalPasswd yes
    #KerberosTicketCleanup yes
    #KerberosGetAFSToken no

    AllowGroups sshusers

    # GSSAPI options
    #GSSAPIAuthentication no
    #GSSAPICleanupCredentials yes

    # Set this to 'yes' to enable PAM authentication, account processing,
    # and session processing. If this is enabled, PAM authentication will
    # be allowed through the ChallengeResponseAuthentication and
    # PasswordAuthentication.  Depending on your PAM configuration,
    # PAM authentication via ChallengeResponseAuthentication may bypass
    # the setting of "PermitRootLogin without-password".
    # If you just want the PAM account and session checks to run without
    # PAM authentication, then enable this but set PasswordAuthentication
    # and ChallengeResponseAuthentication to 'no'.
    UsePAM yes
    #UsePAM no

    #AllowAgentForwarding yes
    AllowTcpForwarding no
    #GatewayPorts no
    #X11Forwarding no
    #X11DisplayOffset 10
    #X11UseLocalhost yes
    #PrintMotd yes
    #PrintLastLog yes
    #TCPKeepAlive yes
    #UseLogin no
    #UsePrivilegeSeparation yes
    #PermitUserEnvironment no
    #Compression delayed
    #ClientAliveInterval 0
    #ClientAliveCountMax 3
    UseDNS no
    #PidFile /var/run/sshd.pid
    MaxStartups 2
    #PermitTunnel no
    ChrootDirectory none
    #ChrootDirectory /var/services/homes/%u
    #DenyUsers admin

    # no default banner path
    #Banner none

    # override default of no subsystems
    #Subsystem   sftp   /usr/libexec/sftp-server
    #Subsystem       sftp    internal-sftp -f DAEMON -l VERBOSE -u 000
    Subsystem       sftp    internal-sftp -f DAEMON -u 000
    #Subsystem       sftp    /usr/syno/sbin/sftp-server -l DEBUG3

    # the following are HPN related configuration options
    # tcp receive buffer polling. disable in non autotuning kernels
    #TcpRcvBufPoll yes
     
    # allow the use of the none cipher
    #NoneEnabled no

    # disable hpn performance boosts.
    #HPNDisabled no

    # buffer size for hpn to non-hpn connections
    #HPNBufferSize 2048


    # Example of overriding settings on a per-user basis
    Match User root
    #   X11Forwarding no
       AllowTcpForwarding yes
    #   ForceCommand cvs server

# 2  
Old 09-02-2014
Hello hicnar,

Welcome to the forum. As per your input provided I can see property PermitRootLogin no which is good enough to stop root to do ssh.
but also there are 2 points which I think you can try.
  1. If you have made changes to your file /etc/ssh/sshd_config recently then please make sure that you need to recycle the service by /etc/init.d/sshd restart command after making changes to file.
  2. If you have done the 1st suggestion(recycling of service after change) I can see there is a property AllowGroups sshusers in the file so I assume root will be also the part of this group too. So we can try to troubleshoot here if this is the cause.

Please do let us know if you have any queries.

NOTE: These are only suggestions please don't perform this in you live environment, you can try the same in your system and check.


Thanks,
R. Singh

Last edited by rbatte1; 09-08-2014 at 11:07 AM.. Reason: Set up LIST=i tags
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Needed SFTP script from windows to UNIX server and from UNIX to windows server(reverse SFTP)

hi guys, i need a script to sftp the file from windows to unix server ....(before that i have to check whether the file exists in the windows server or not and again i have to reverse sftp the files from unix to windows server..... regards, Vasa Saikumar. (13 Replies)
Discussion started by: hemanthsaikumar
13 Replies

2. UNIX for Dummies Questions & Answers

Accessing mail server from UNIX

Hi all, I need to access the mails sent to me in a mail server(IMAP mail server), and download the attachment sent in the mail to the unix environment. Please help me to acheive the same. I am not able to install python , PHP modules in my unix box due to installation restriction in my work... (3 Replies)
Discussion started by: arun1377
3 Replies

3. UNIX for Advanced & Expert Users

Accessing secured server using shell script

Hi, I was trying to connect secure server using SFTP, but end up in error. Im looking for a shell script which will connect my secured FTP server For EG: hostname = example.com username = fed password = pass port = 993 Destination = web Push some tar file into web folder which is in... (3 Replies)
Discussion started by: Paulwintech
3 Replies

4. Solaris

Accessing Solaris Server

Dear all, We have a Solaris Server at other location. Can we access the Server from remote ....Any software is needed for this ....pl help. Rgds Rj (7 Replies)
Discussion started by: jegaraman
7 Replies

5. UNIX for Dummies Questions & Answers

Only root can login using SFTP

Hello, It seems on a machine that I am responsible for supervising only root can use ssh/sftp services. I have looked at sshd_config and do not see anything that can fix this. PermitRootLoggin is enabled but that option does not preclude other users from using ssh/sftp services. When I try and... (5 Replies)
Discussion started by: mojoman
5 Replies

6. UNIX for Advanced & Expert Users

sftp only works for root

Hi all, I have an aix 5.3 running open ssh 1.75 i think only root can sftp into the server. I appears to authenticate OK via the verbose output. Here it is: ################################################ ################################################ ... (3 Replies)
Discussion started by: dfezz1
3 Replies

7. Shell Programming and Scripting

Accessing windows server

Hello guys, i have a scenario that i need to run some commands on a unix machine and them connect on a windows server machine stop some services and them back to the Unix machine do another commands.. There is a way to do that with shell script? tks (1 Reply)
Discussion started by: paddock
1 Replies

8. UNIX for Advanced & Expert Users

accessing ms access from unix server...

Hello, I have a databse stored in my Unix server. I can't change the database because is used by a third party software. How Can I make some queries to this database (I want to extend the information for all the users using Apache + php on the unix server.) I looked at unixODBC but I... (0 Replies)
Discussion started by: ncatdesigner
0 Replies

9. UNIX for Dummies Questions & Answers

Accessing Unix from Server

I am trying to access my school's unix server. On one of the tutorials they passed out there were instructions on how to dial a modem to connect or something but I think i should be able to connect to it through my school's internet connection. All of my school's computers has access to a unix... (1 Reply)
Discussion started by: UMiami10
1 Replies

10. UNIX for Dummies Questions & Answers

Remotely accessing a server

Ok, so I'm a total beginner when it come to unix shells, but my friends and I are starting to get into it. It turns out that I have an extra computer lying around and I want to set it up as a server se we can run shell commands on it. Does anyone know of any guides on how to set up the... (3 Replies)
Discussion started by: rogre
3 Replies
Login or Register to Ask a Question