I have set up a headless home file server using Ubuntu Server 17.04. I access it over WiFi using SSH from my laptop running standard Ubuntu 17.04. I have found that SSH (SFTP) is sufficient for my needs for serving files (e.g. music and photographs) for my home network.
Now I would like to be able to upload files to a folder on my server's hard drive /dev/sda1
, which is currently mounted as /media/a
. It uses the ext4 Linux filesystem and I mounted it using the command sudo mount /dev/sda1 /media/a
.
I can run SSH commands from the terminal (by logging in with ssh username@servername
) and I can access the files via the GUI on my laptop (files > other locations > connect to server > sftp://username@servername). However when I try to create a new folder (say) it says
Error creating new folder: permission denied.
I tried setting the permissions on an upload
folder (newly created via my ssh session) with sudo chmod o=rwx /media/a/upload
. However, when I now try to create a folder there via the GUI on my laptop, it says
Error creating new folder: unknown reason.
How can I upload files to my server from my laptop?
EDIT: Here is the contents of my /etc/ssh/sshd_config
file, as requested:
# $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 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 override the
# default value.
#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key
# Ciphers and keying
#RekeyLimit default none
# Logging
#SyslogFacility AUTH
#LogLevel INFO
# Authentication:
#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
#PubkeyAuthentication yes
# Expect .ssh/authorized_keys2 to be disregarded by default in future.
#AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2
#AuthorizedPrincipalsFile none
#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# 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 yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no
# 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
#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation sandbox
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none
# no default banner path
#Banner none
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
# override default of no subsystems
Subsystem sftp /usr/lib/openssh/sftp-server
# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# PermitTTY no
# ForceCommand cvs server
EDIT: The following is the output of the various commands requested in the comments
username@servername:~$ findmnt /media/a
TARGET SOURCE FSTYPE OPTIONS
/media/a /dev/sdc1 ext4 rw,relatime,data=ordered
username@servername:~$ namei -lx /media/a
f: /media/a
Drwxr-xr-x root root /
drwxr-xr-x root root media
Drwxr-xr-x root root a
username@servername:~$ id
uid=1000(user) gid=1000(user) groups=1000(user),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),111(lxd),116(sambashare),117(lpadmin)
username@servername:~$ getfacl /media/a
getfacl: Removing leading '/' from absolute path names
# file: media/a
# owner: root
# group: root
user::rwx
group::r-x
other::r-x
username@servername:~$ mkdir -v /media/a/upload
mkdir: cannot create directory ‘/media/a/upload’: Permission denied
sudo mount /dev/sda1 /media/a
. Sorry for not adding it to the question before - didn't know that could be relevant - does this answer your question? – 08Dc91wk Jun 25 '17 at 19:10sshd_config
? What errors you can see in the logs? – Jakuje Jun 25 '17 at 19:28sshd_config
is or how to access the logs. I'm sure I can find this information with Google though, will take a look and update the question. – 08Dc91wk Jun 25 '17 at 19:31sshd_config
(in /etc/ssh/) - I haven't modified this file, what settings do you need to know? Or should I paste the whole file (if so - is there any sensitive information in here I should redact?) – 08Dc91wk Jun 25 '17 at 19:42/var/log/auth.log
, reproduced theError creating new folder: unknown reason.
, and checked/var/log/auth.log
again. No new logs were created here. Perhaps I should turn up the verbosity? – 08Dc91wk Jun 25 '17 at 19:47findmnt /media/a
,namei -lx /media/d
andid
– muru Jun 29 '17 at 07:37/media/a
, e. g. the output ofgetfacl /media/a
(or remotely withssh username@servername [COMMAND]
)? What happens when you runssh username@servername mkdir -v /media/a/upload
? – David Foerster Jun 29 '17 at 18:57awk '$2=="/media/a"' /proc/mounts
? Thanks. – David Foerster Jul 01 '17 at 23:32