About the functionality in question
The functionality "Follow terminal folder" is the feature "Follow SSH path".
- Right-click the session profile > "Edit session"
- In "Session Settings":
"SSH" > Tab "Advanced SSH settings"
- See item: "Follow SSH path (experimental)"
=> Changing this setting will change the hook in "Follow terminal folder" at session start.
This feature is marked and documented as experimental.
MobaXterm Documentation 4.1.10 :
Follow SSH path (experimental)
Automatically place the graphical SSH-browser in the same directory than the SSH terminal.
Note: This feature is experimental and it will not work on old Unix systems.
=> Besides configuration problems, limitations in functionality and bugs in the code have to be taken into account as the origin of these problems.
Issue 0: Update and reset the software
Update
At software, especially if an experimental feature is in the focus of the problem, update the software to the latest state. And always use the official download source of the product developers, not a third party like software portals.
https://mobaxterm.mobatek.net/download.html
Reset the software configuration
As User shalnarkftw already proposed in his answer, resetting the configuration of the software is a good idea for tracking down issues.
For the portable version these are the items to BACKUP & eliminate:
MobaXterm.ini
, MobaXterm backup.zip
(backups of passed ini-files)
These files sould be stored in the same directory as your portable executable MobaXterm_Personal_23.2.exe
.
%TEMP%\Mxt232
(MobaXterm runtime and its CygWin ecosystem)
- Registry key:
HKCU\SOFTWARE\MobaXterm
You write your MobaXterm.ini
is not at the expected place. This is a hint for problems, so doing this is important.
To find your displaced MobaXterm.ini
seach for it, i.e. via commandline:
dir /a /s /b C:\MobaXterm.ini
Issue 1: SSH Protocol Version
Problem:
My impression is, when using the protocol version SSH-1, the GUI-tree will not follow the command line path.
I think, this is meant by the text "will not work on old Unix systems".
Workaround:
Force the protocol version SSH-2
- Right-click the session profile > "Edit session"
- In "Session Settings":
"SSH" > Tab "Advanced SSH settings" > Button "Expert SSH settings"
- Choose item: "SSH protocol version"
=> Change to SSHv2
- After saving the changes to the session profile:
EXIT & RESTART the program "MobaXterm"
Without the restart the old setting might stay active for the next session. (probably an application bug with to RAM loaded settings that will not be reset after use.)
Issue 2: Folder-View not active while directory change in terminal
Problem:
If you switch the view of the left pane to a different tab and then change the folder in the terminal, the folder-view will not follow.
Workaround:
When you change back to the folder view, type at the terminal:
cd .
This will update the folder pane.
Issue 3: Disturbing output in SFTP session of GUI directory view
The GUI directory view is generated by a second connection that uses SFTP (/usr/lib/openssh/sftp-server
).
Thanks to the link in the comment of subdeveloper (MobaXTerm "Follow Terminal Folder" STFP and Byobu) we know there are problems when the console generates output in a SFTP session.
Perhaps in the test before you might have seen something in the ps
-tree of the SFTP session. This would be a great hint.
But anyway, you should search all of your login scripts for commands that might generate some output.
These lines have to be patched by extending them with > /dev/null 2>&1
so any output (stdout
and stderr
) to the console is prohibited.
Such a line would look like
# before:
command
# after:
command > /dev/null 2>&1
Please evaluate, if the individual lines are really relevant.
At least for testing your issue, you might want to #
disable them.
The names of the relevant files depend on the shell you use.
For bash
this would be:
~/.bashrc
~/.bash_login
~/.bash_profile
~/.profile
/etc/bash.bashrc
/etc/profile
/etc/profile.d/* # Debian specific
Issue 4: Sub-Shell opened
Problem:
If you execute sh
, bash
or any other shell, then the folder view will not follow anymore your cd
commands.
The most probable situation to trigger this is switching the user:
su username
or
sudo -s
or similar.
Note:
This is not an error but works as shells are designed:
The folder view follows the login shell.
By executing a shell you start a shell within a shell. Everything what happens within this sub-shell will not take effect to the login shell.
Solution:
Exit the shell by the exit
command and you should return to the login shell.
A pwd
command will show that you are back at the position displayed in the folder view. On changing the directory the folder view will follow.
(If the MobaXterm terminal session quits, you have not been in a sub-shell but in the login shell and just terminated it.)
How to check for the presence of a sub-shell
Open a second session to the server for investigation.
for these two conditions ...
- when there is no problem in your production session
- when the problem is present in your production session
... issue this command in the second shell:
ps faxu | grep -B1 -A10 "sshd: LOGIN_USER"
(LOGIN_USER should be replaced by the login stored in the profile.)
The output will look somewhat like the following, but the order might differ:
(added some comment to the output )
# Production session. At fresh startup it should contain only these lines:
root 1179 0.0 0.0 12184 2644 ? Ss Jul23 0:00 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
root 102429 0.0 0.0 12304 6184 ? Ss 17:12 0:00 \_ sshd: user [priv]
user 102431 0.0 0.0 12836 5412 ? S 17:12 0:00 | \_ sshd: user@pts/5
user 102434 0.0 0.0 5304 4380 pts/5 Ss+ 17:12 0:00 | \_ -bash
# Session of the GUI directory following the *production session*:
root 102432 0.0 0.0 12304 6148 ? Ss 17:12 0:00 \_ sshd: user [priv]
user 102447 0.0 0.0 12544 5164 ? S 17:12 0:00 | \_ sshd: user@notty
user 102448 0.0 0.0 5892 3492 ? Ss 17:12 0:00 | \_ /usr/lib/openssh/sftp-server
# The session for investigation, just generating this output data:
root 105056 0.0 0.0 12304 7312 ? Ss 18:57 0:00 \_ sshd: user [priv]
user 105059 0.0 0.0 12836 5840 ? S 18:57 0:00 | \_ sshd: user@pts/6
user 105062 0.0 0.0 5304 4488 pts/6 Ss 18:57 0:00 | \_ -bash
user 105315 0.0 0.0 6432 3288 pts/6 R+ 19:13 0:00 | \_ ps faxu
user 105316 0.0 0.0 3312 712 pts/6 S+ 19:13 0:00 | \_ grep --color=auto -B1 -A10 sshd: user
# Session of the GUI directory following the *investigation session*:
root 105060 0.0 0.0 12304 7236 ? Ss 18:57 0:00 \_ sshd: user [priv]
user 105079 0.0 0.0 12544 5576 ? S 18:57 0:00 \_ sshd: user@notty
user 105080 0.0 0.0 5892 4256 ? Ss 18:57 0:00 \_ /usr/lib/openssh/sftp-server
# Some other processes that are not of interest:
root 1675 0.0 0.0 9784 1052 ? Ss Jul23 0:00 /usr/sbin/cron -f
daemon 1682 0.0 0.0 3804 684 ? Ss Jul23 0:00 /usr/sbin/atd -f
[...]
=> Check the output of both test conditions for differences in the production shell and the associated SFTP-connection.
Your specific problem / Feedback required
To get better in contact with your specific "folder view" problem, please improve your question by adding details an samples:
- What did you do when the problem occurred?
- How shows up the problem?
Update
You state after forcing SSHv2
(default is Auto
) nothing in the erratic behavior has changed. This proves the connection to your server is using the SSHv2 protocol even if you use the setting Auto
.
So the error class "old Unix systems" is not your source of the problem.
Please leave your setting at "SSHv2 only".
It would be great to get a more detailed description of your problems:
- How are they triggered?
- What's the effect on the folder view?
- Does the problem vanish or you have to restart the whole session? Always?
As you describe it as unpredictable, there might be multiple triggers. Several examples might be helpful.
(Please note: I've added a third issue/solution pair above.)
Update 2
Thank you for your EDIT3.
Sometimes I have to close and restart the session several times for the issue to be solved.
I assume, you always start the same session profile under the same conditions.
Now essentially we are looking for two things:
- Exclude the a sub-shell as the problem
- Eliminate disturbing output from the session of the following tree-view.
Added Issue 3 + 4 to the list to describe these steps.
Please verify and provide feedback.