Bug 2760

Summary: cd Command With No Arguments
Product: Portable OpenSSH Reporter: skerbsf
Component: sftpAssignee: Damien Miller <djm>
Status: CLOSED FIXED    
Severity: enhancement CC: djm, dtucker
Priority: P5    
Version: 7.5p1   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 2782    
Attachments:
Description Flags
support ch/lcd with no arguments dtucker: ok+

Description skerbsf 2017-08-16 04:19:52 AEST
This is a usability issue that is debatable.  The sftp client currently returns an error when no arguments are given.  It appears that the server does not even get involved.

> sftp kona3
Connecting to kona3...
Password: 
sftp> cd
You must specify a path after a cd command.

Personally, I believe that the client should change into the remote home directory when cd with zero arguments is typed.  This would mimic the behavior users expect/are used to on UNIX filesystems/utilities.  Of course, I am new here and have different expectations, but this does seem like a usability issue IMO.  Thanks.
Comment 1 Damien Miller 2017-11-03 14:07:26 AEDT
Created attachment 3083 [details]
support ch/lcd with no arguments

This implements most of your request. The problem is that sftp can't determine the actual user home directory on the remote side, so this saves the directory that the session starts in and uses that.
Comment 2 Damien Miller 2017-11-03 16:14:05 AEDT
This is committed and will be in OpenSSH 7.7
Comment 3 Damien Miller 2021-04-23 15:10:02 AEST
closing resolved bugs as of 8.6p1 release