Just noticed some odd behaviour in the identity file option with ~. If you don't leave a space between -i and the filename the ~ is not expanded and thus the file is not found. If you leave a space it works as expected. ie This doesn't work: ssh -i~/key_file This does: ssh -i ~/key_file Excerpts from respective strace: ---snip-- stat("~/.ssh/keyfile", 0x7fff73320010) = -1 ENOENT (No such file or directory) write(2, "Warning: Identity file ~/.ssh/ke"..., 82Warning: Identity file ~/.ssh/keyfile not accessible: No such file or directory. ---snip-- ---snip-- stat("/home/ec2-user/.ssh/keyfile", {st_mode=S_IFREG|0600, st_size=1676, ...}) = 0 write(2, "usage: ssh [-1246AaCfgKkMNnqsTtV"..., 524usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec] ---snip-- Without a tilde it works with or without a space.
The reason for the discrepancy is that in this case, -i doesn't do tilde expansion, the shell does. It only does it at the start of an argument, and when you combine the arguments like that it doesn't expand: $ echo -i~/bin -i~/bin $ echo -i ~/bin -i /home/dtucker/bin This then falls foul of the file existence check inside the -i handling: case 'i': if (stat(optarg, &st) < 0) { fprintf(stderr, "Warning: Identity file %s " "not accessible: %s.\n", optarg, strerror(errno)); break; } add_identity_file(&options, NULL, optarg, 1); break; and the key doesn't get added before the call to tilde_expand_filename later. We could probably fix this by adding a call to tilde_expand_filename in the -i handling.
Created attachment 2731 [details] Expand tildes for arguments passed to -i. Please try this patch.
Created attachment 2732 [details] Expand tildes for arguments passed to -i. oops, missed a line.
Ah, didn't occur to me that is was the shell. Yep, that patch seems to work for me.
(slightly simplified) patch applied and will be in the 7.2 release. Thanks.
Close all resolved bugs after 7.3p1 release