When connected to an old remote system with Tramp 2.4.3.27.1, the buffer shows no files. With tramp-verbose
set to 6, I looked at the Tramp debug buffer, then found (anonymized):
13:27:21.657267 tramp-send-command (6) # /bin/ls --color=never --dired -algGh /user/user/. 2>/dev/null
When I remove 2>/dev/null
and execute the above command, I get:
/bin/ls: invalid option -- h
Try `/bin/ls --help' for more information.
ls
on the remote system is part of GNU fileutils 3.16 and does not support the option -h
. For my regular system I have configured dired+:
(dired-listing-switches "-algGh")
Is there any way to use a different configuration for that remote system?
What I tried, unsuccessfully:
(connection-local-set-profile-variables
'example.com
'((dired-listing-switches nil)))
(connection-local-set-profiles
'(:application 'tramp :machine "example.com")
'example.com)
How I connect to the old system
The system only supports connection by SSH v1. For that purpose, plink
and pscp
do support the option -1
. So I added to tramp-connection-properties
:
("/plink:user@example\\.com:" "login-args"
(("-1")
("-l" "%u")
("%h")))))
Now I can connect to /plink:user@example.com:
.
My solution
Thanks to Michael Albinus’ answer, I came up with:
(defun my-dired-before-readin-hook ()
(let ((remote-host (file-remote-p default-directory 'host)))
(when (string= remote-host "example.com")
(setq dired-actual-switches "-algG"))))
(add-hook 'dired-before-readin-hook 'my-dired-before-readin-hook)