SFTP with admin user to migrate uploads folder content

Now just tried with admin user and SFTP and realized the admin does not seem to have the permissions to create all the directories inside the uploads folder:

    Command:	cd "/srv/www/domain.com/shared/uploads"
    Response: 	New directory is: "/srv/www/domain.com/shared/uploads"
    Command:	mkdir "js_composer"
    Error:        	mkdir /srv/www/domain.com/shared/uploads/js_composer: permission denied
    Command:	mkdir "/srv/www/domain.com/shared/uploads/js_composer"
    Error:        	mkdir /srv/www/domain.com/shared/uploads/js_composer: permission denied
    Command:	cd "/srv/www/domain.com/shared/uploads/js_composer"
    Error:        	Directory /srv/www/domain.com/shared/uploads/js_composer: no such file or directory

ownership and permissions are:

admin@domain:/srv/www/domain.com/current/web/app/uploads$ ls -la
total 24
drwxr-xr-x 6 web www-data 4096 Aug 23 12:36 .
drwxr-xr-x 4 web www-data 4096 Aug  6 03:26 ..
drwxr-xr-x 3 web www-data 4096 Aug 10 07:30 2016
drwxr-xr-x 2 web www-data 4096 Aug 23 12:36 buddydrive
drwxr-xr-x 2 web www-data 4096 Aug 23 12:36 buddydrive-thumbnails
drwxr-xr-x 2 web www-data 4096 Aug 10 07:30 wp-sync-db

but I checked and admin cannot create directories. Not after ssh-ing into the server, not after accessing the server using SFTP. Ideas why? Done on purpose and should I only upload via media uploader and just now add uploads folder content to repo and not have it ignored maybe?

Why not use a nice uploads sync playbook?

1 Like

You can also do a two/three step process:

  1. SFTP uploads to /home/admin/uploads
  2. SSH in as admin
  3. sudo su (use your admin pw) to become root
  4. chown -R web:www-data /home/admin/uploads
  5. su web (now you’re the web user)
  6. Move/copy uploads to proper dir now

edit: or some variation of that.

2 Likes