0

Sometimes the Follow terminal folder option doesn't work:

enter image description here

The Follow terminal folder function is very helpful to see the files inside the folder and open it with Notepad++.


EDIT
I'm now in China and connect through a VPN. This is slower than what I'm used to. I've noticed that I experience the Follow terminal folder failure more often nowadays, because of the slow connection (I suppose).


EDIT2
I followed the steps laid out by @dodrg. First I selected the Follow SSH path (experimental) in the Session settings:

enter image description here

Then I clicked the button Expert SSH Settings and changed the value in the dropdown menu from auto into SSHv2:

enter image description here

The only change so far I experience, is that the Follow terminal folder checkbox is now checked by default when I launch the session:

enter image description here

However, its functionality is still unstable. Sometimes it follows the cd commands I enter in the terminal, sometimes not. Very unpredictable.


EDIT3

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?

The problem, when it manifests itself, it's always the moment I launch the session. Once the problem is there, it never resolves itself spontaneously. The only way to solve it, is to close and restart the session. But even that is not always effective. Sometimes I have to close and restart the session several times for the issue to be solved.

The effect on the folder view: it is stuck in the /home/<username> folder. Well, maybe "stuck" is the wrong word, because I can still navigate within the folder view manually (clicking folders, entereing another path, ...). However, it won't follow any cd commands I issue in the terminal.

K.Mulier
  • 8,069
  • 15
  • 79
  • 141
  • Can you try these [MobaXTerm Follow Terminal Folder STFP and Byobu](https://stackoverflow.com/questions/41830936/mobaxterm-follow-terminal-folder-stfp-and-byobu) and [MobaXTerm Follow Terminal Folder STFP & Fish Shell](https://superuser.com/questions/1607624/mobaxterm-follow-terminal-folder-stfp-fish-shell) – subdeveloper Jul 11 '23 at 00:51

4 Answers4

1

About the functionality in question

The functionality "Follow terminal folder" is the feature "Follow SSH path".

  1. Right-click the session profile > "Edit session"
  2. In "Session Settings":
    "SSH" > Tab "Advanced SSH settings"
  3. 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

  1. Right-click the session profile > "Edit session"
  2. In "Session Settings":
    "SSH" > Tab "Advanced SSH settings" > Button "Expert SSH settings"
  3. Choose item: "SSH protocol version"
    => Change to SSHv2
  4. 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 ...

  1. when there is no problem in your production session
  2. 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:

  1. Exclude the a sub-shell as the problem
  2. 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.

dodrg
  • 1,142
  • 2
  • 18
  • Thank you @dodrg for your elaborate answer. I followed the steps you suggested, but the result is still unpredictable (see my latest **EDIT** in my question-post). – K.Mulier Jul 22 '23 at 06:09
  • @K.Mulier Answer UPDATED // My hint to *"Session Settings" > "Follow SSH path"* only proves (1) It's the same item as *"Follow terminal folder"* despite their different names. (2) It shows this feature is *"officially marked as experimental"*. (that's not a solution) // *`experimental` means: *"Problems have to be expected"*. Knowing this is essential to consolidate your expectations. By being experimental, the probability gets relevant that a solution might depend on a software update. – dodrg Jul 22 '23 at 10:18
  • Thank you @dodrg. I've added **EDIT3** to my original post, with the replies on the questions you asked for more info. – K.Mulier Jul 24 '23 at 06:33
  • Answer updated by ***Update 2*** – dodrg Jul 26 '23 at 18:22
0

What version of mobaxterm you're using ? I recommend you the portable version if you have an installed mobaxterm on your laptop.

You can also try to backup your MobaXterm\MobaXterm.ini and delete it.

Hope this helps.

shalnarkftw
  • 402
  • 2
  • 8
  • I just updated to version v23.2 Build 5082 - the portable one. Still same problem. – K.Mulier Jul 13 '23 at 10:24
  • 1
    did try to delete the mobaxterm config file ? MobaXterm\MobaXterm.ini don't forget to backup it ! you can also try contacting mobaxterm support team. the're reactive I've already contacted them for another issue and got help. https://mobaxterm.mobatek.net/contact.html Hope this helped you good luck for the rest – shalnarkftw Jul 13 '23 at 12:49
  • Hi @shalnarkftw - where exactly can I find this `MobaXterm.ini` file? – K.Mulier Jul 22 '23 at 06:11
  • The MobaXterm.ini configuration file should be located in the same folder as MobaXterm executable if you are using the portable edition. – shalnarkftw Jul 22 '23 at 16:40
  • I am using the portable edition. There is no `MobaXterm.ini` file there. Only `CygUtils.plugin` and `MobaXterm_Personal_23.2.exe` – K.Mulier Jul 23 '23 at 02:39
  • I think you can find It in Documents folder – shalnarkftw Jul 24 '23 at 08:02
  • Search for it, i.e. via command line: `dir /a /s /b C:\MobaXterm.ini`. As there is more to eliminate, to reset the software, I extended by answer, by the paragraph *Reset the software for a clean test status* // Resetting is really a good idea. Backing up the config, too. // *Please tell us how resetting of the configuration changed the behavior*. – dodrg Jul 24 '23 at 11:03
  • @K.Mulier Any updates ? did you found the .ini file ? Try also to delete the current version and install a new one maybe this'll work – shalnarkftw Jul 26 '23 at 09:09
0

Make sure you have the latest version of MobaXterm installed on your system. If its not then Visit the official MobaXterm website or the software's update mechanism to check for any available updates. You can also verify the configuration: Go to the MobaXterm settings and verify that the "Follow terminal folder" option is enabled. You can usually find this option under the "Settings" or "Configuration" section. Make sure it is set to "On" or "Enabled".

Sometimes, restarting the application can help resolve temporary glitches or issues. Close MobaXterm completely and relaunch it to see if the "Follow terminal folder" functionality starts working. Also Ensure that you have the necessary permissions to access the folder and its contents. If the folder or files have restricted permissions, you may encounter issues when attempting to follow the terminal folder.

Muhammad Hassan
  • 235
  • 1
  • 2
  • 7
  • If my response was helpful in resolving the issue, I kindly request you to consider accepting and upvoting the answer. By doing so, you can help close this thread as solved and provide feedback on the usefulness of the information provided. Thank you! – Muhammad Hassan Jul 13 '23 at 09:52
  • "You can also verify the configuration: Go to the MobaXterm settings and verify that the "Follow terminal folder" option is enabled." Can you show some screenshots? I can't find this option anywhere. – K.Mulier Jul 13 '23 at 10:23
  • I awarded you the bounty, because I only had one minute left to decide. But please help me with some screenshots to find that "Follow terminal folder" option :-) – K.Mulier Jul 13 '23 at 10:26
  • Hi Muhammad, why you're not responding anymore? – K.Mulier Jul 20 '23 at 03:21
-6

try this sudo vim /etc/sudoers, add follow content in the bottom

current_user    ALL=(ALL:ALL) ALL
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • 4
    **do not follow this advice** This gives anyone on the machine root access and is therefore a big security hole! Also it is not clear from the answer how this should solve the problem – akraf Jan 24 '23 at 12:25