Jump to content
phyllisstein

Secure Copy Workflow

Recommended Posts

Now available at this link and, with the newer, trimmer PyAl, in AlfPT: a Secure Copy workflow. Using the `scp` command, it uploads a local file or folder to a designated remote server over SSH, then copies the file's URL to the clipboard. Just enter scp and select "Add Server to Favorites" to get started!

 

Store a server by selecting "Add Server to Favorites," which will save your password information securely in the Keychain via PyAl; upload the selection of the frontmost Finder window by selecting "Upload to Server" and selecting a server; upload an explicit path or list of paths by selecting "Upload to Server," selecting a server, and entering your paths (separated by spaces—the workflow knows the difference between a space in a path and a space between paths); and enable the workflow as a File Action by designating a default server and then using it from any file's action list (with support for multiple files).

 

If that all sounds very confusing, rest assured that it makes much more sense when you get your hands on it.

 

Enjoy and test and let me know if anything breaks!

 

Screen%20Shot.png

Screen%20Shot%201.png

Screen%20Shot%202.png

Share this post


Link to post

two issues:

  1. multiple files action: only the first one get transferred. 
  2. no notification. possibly because the {query} is empty

Do you by any chance have a certificate installed such that you don't have to log into your SSH server manually?

Share this post


Link to post

Do you by any chance have a certificate installed such that you don't have to log into your SSH server manually?

Yes, I do use ssh keys to avoid login. Is that a issue?

Share this post


Link to post

Yes, I do use ssh keys to avoid login. Is that a issue?

It appears to be. The problem is that the command never outputs a login prompt, so `expect` winds up waiting around forever to send it your password. I've been having the same problem on my system, but haven't come up with a workaround yet. I'll put s'more energy into it today, though.

Share this post


Link to post

Yes, I do use ssh keys to avoid login. Is that a issue?

May've been a bit easier than I expected. Try downloading the latest version, see if that doesn't work for you.

Share this post


Link to post

May've been a bit easier than I expected. Try downloading the latest version, see if that doesn't work for you.

Thanks! It is working now.

 

one improvement i would suggest is the notification message - it is too long. It would be better to just show succeed or fail. Thanks! 

Share this post


Link to post

Excellent idea for a workflow. Unfortunately I'm new to scp and don't know what to put for [baseurl] when creating favourites. 

 

Sorry, that's a little unclear in the directions. It would ideally be a URL that points to the folder on the remote server you're uploading to. So if I'm uploading to /home/bob/www/folder on my remote server, and /www/ is my web root, I might specify http://www.bob.com/folder/ for the base URL. Then, the file's URL will be copied to the Clipboard after the upload is complete. It's not really necessary for scp to run—you could enter anything there. In a future release, it'll hopefully be rejiggered so it's optional.

Share this post


Link to post

Sorry, that's a little unclear in the directions. It would ideally be a URL that points to the folder on the remote server you're uploading to. So if I'm uploading to /home/bob/www/folder on my remote server, and /www/ is my web root, I might specify http://www.bob.com/folder/ for the base URL. Then, the file's URL will be copied to the Clipboard after the upload is complete. It's not really necessary for scp to run—you could enter anything there. In a future release, it'll hopefully be rejiggered so it's optional.

Thanks, I thought that's what baseurl might mean, but thought it might be a required field (I just put a / in place for the base url) but it's still not working to send files to my NAS. I can scp in a terminal window using the same details. Before I would put up a notification within a second of executing and now it's not giving me a notification after I changed the port to the default 22 thinking the port might have been the problem.

Any ideas? Activity monitor doesn't show any significant activity (using  300mb and 3mb files to test) and the file isn't showing up on the other end.

Share this post


Link to post

Thanks, I thought that's what baseurl might mean, but thought it might be a required field (I just put a / in place for the base url) but it's still not working to send files to my NAS. I can scp in a terminal window using the same details. Before I would put up a notification within a second of executing and now it's not giving me a notification after I changed the port to the default 22 thinking the port might have been the problem.

Any ideas? Activity monitor doesn't show any significant activity (using  300mb and 3mb files to test) and the file isn't showing up on the other end.

 

Where did you change the port? scp should know by itself which port to use, as far as I can tell; the configuration in Alfred should just be a server's IP or hostname. Are you sure your network-attached storage device is running an SSH server?

Share this post


Link to post

Where did you change the port? scp should know by itself which port to use, as far as I can tell; the configuration in Alfred should just be a server's IP or hostname. Are you sure your network-attached storage device is running an SSH server?

Sorry I should have been more specific. I have more than one machine that I access via ssh so originally I had my router forward port 2222 to the correct machine at port 22. So I just changed the router settings so that machine is now port 22. I just wanted to remove the port from the list of possible problems. I added the server to Alfred using the command below:

 

scp add htpc-tv user password address.no-ip.info /media/video/downloads/post-process/television /

 

I tried it with and without a / at the end of the path and I just use a / for the baseurl

 

If I type the following a terminal window it works. So it shouldn't be an issue on the receiving end:

 

scp file.dmg user@address.no-ip.info:/media/video/downloads/post-process/television/

Scott

P.S. Sorry to keep bothering you, I just think this is such a cool workflow and would use it frequently if I could get it to work.

Share this post


Link to post

Not to worry, Scott! I'm glad to help, and I'd love to see the workflow be useful to you. There are a few things that I'm wondering. First of all, which method are you using to upload the file? Are you using the workflow as a file action, that is, or uploading the Finder selection, or entering a path by hand? Next, I've uploaded a new version of the workflow to http://d.pr/f/4Io4 ; it makes specifying the base URL optional, so you can just action the "add" command after entering the remote path. It'll also output some .log files to the workflow's folder, which I'd be grateful if you could e-mail to me after testing it (I'm d at daniel dot sh). Finally, if all else fails, maybe you could PM me with the actual command you're using (minus the password, of course; problem's likely not there) and I could try to reproduce the error.

 

Good luck, and I'm sorry for the trouble!

Share this post


Link to post

Just wanted to let everyone know that I think whatever bug Scott—or maybe everyone—was dealing with has been squashed. I've updated the version at http://alfred.daniel.sh/Workflows/SecureCopy.alfredworkflow to reflect the changes; it also makes specifying the base URL optional. Verbose logging has been pulled out of the script, though, so it won't generate too much garbage on your hard disk. Enjoy!

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...