Run TC in read-only mode, is it possible?

English support forum

Moderators: Hacker, petermad, Stefan2, white

GT19
Junior Member
Junior Member
Posts: 6
Joined: 2020-11-06, 09:53 UTC

Run TC in read-only mode, is it possible?

Post by *GT19 »

Hi!

During my work (now in home office) I often have to browse through and read documents located on file shares on company servers, therefore at any given moment I probably have one or more TC-s open with the content of those resources showing in them.
Most of the time I only have to read stuff, but sometimes I have to edit too (create/delet/edit files or folders), therefore I have write access to those resources.
Is three a way to switch (or run) TC in read-only mode to avoid accidental edit/move/delete operations?

(I know it is possible to set TC to ask for confirmation in cases like that, but I have a cat , who can "accidentally" step on the Enter key in a case like that, so I am afraid a simple "Are You sure?" kind of confirmation is not good enough.)

Thanks.
User avatar
Dalai
Power Member
Power Member
Posts: 9974
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Run TC in read-only mode, is it possible?

Post by *Dalai »

All you can do is to remap the keys that start deletions, namely F8 and DEL (delete) as well as F4 (edit) and F6 (move), in TC's options > Misc section. Remap these keys to a command that doesn't do anything drastic like cm_RereadSource or cm_FocusLeft or similar. And maybe hide the function key buttons (Options > Layout) because dragging files to such a button also starts the corresponding operation. Keep in mind that the context menu still works and is another way to edit/move/copy/delete files.

However, as such remappings would seriously hamper the regular work in TC, I recommend to start TC with a separate INI, like this:

Code: Select all

totalcmd.exe /i="%TEMP%\work.ini"
(Replace totalcmd.exe by totalcmd64.exe if you use TC 64-bit.)
And to be able to tell which TC instance is active, maybe change the colors, especially the background color. See Options > Color

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50561
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Run TC in read-only mode, is it possible?

Post by *ghisler(Author) »

If you just want to prevent opening of files via double click or enter, you can add
RestrictInterface=128
to the wincmd.ini section [Configuration]

From the help:
RestrictInterface= Disable parts of the user interface. Just build the sum of the following options:
1=Start menu
2=Command line
4=Buttonbar change
8=Drive right click menu
16=File right click menu
32=Directory hotlist change
64=FTP (CTRL+N, CTRL+F)
128=ENTER key (run programs, open files)
256=File system plugins
512=Port connection (via USB or LPT)
1024=Disable update checks (manual and automatic)
2048: Disallow plugins except if signed by us (ghisler)
4096: Disallow plugins without a valid digital signature
6144: Disallow all plugins
Author of Total Commander
https://www.ghisler.com
GT19
Junior Member
Junior Member
Posts: 6
Joined: 2020-11-06, 09:53 UTC

Re: Run TC in read-only mode, is it possible?

Post by *GT19 »

@2ghisler(Author)
I am more worried about deleting files or folders accidentally (because it is possible to do with only 2 key presses in the "best" case).
Opening files unintentionally is not really a concern, because it is much less probable to open AND edit AND than save a file by random keystrokes, I think (as opposed to pressing DEL and Enter, which are close to each other, by chance).
Though, It would be nice to be able to prevent this too.
The best solution would be to have a command or switch to put TC in read only mode, but setting it to ask for confirmation AND disabling Enter seems to be a sufficient workaround for now.

Thank You!
User avatar
petermad
Power Member
Power Member
Posts: 16034
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Run TC in read-only mode, is it possible?

Post by *petermad »

2GT19
AND disabling Enter seems to be a sufficient workaround for now.
It is only Enter on items in the file panels - not Enter in dialog boxes that is prevented with RestrictInterface=128 - so Del -> Enter = Disaster
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
nsp
Power Member
Power Member
Posts: 1925
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: Run TC in read-only mode, is it possible?

Post by *nsp »

@2GT19
You should probably make a suggestion to have a kiosk mode for TC where most of the file operations are prevented. This is the most secure from TC.


Another way is as suggested to redefine all file operation hotkey with a null user command in a special totalcmd.ini.
With some additional macro/automation soft like powerpro, autoit, autohotkey .... you can catch keystrokes before it reach totalcmd and then prevent some of the issues.

Another solution is to have a dedicated user who only have read only access on the system and then launch TC.
umbra
Power Member
Power Member
Posts: 876
Joined: 2012-01-14, 20:41 UTC

Re: Run TC in read-only mode, is it possible?

Post by *umbra »

Mounting the share twice (once with RW and once with RO rights) and then accessing two different paths in TC seems more reliable. That would decrease chances of accidental changes also by other software and not just TC itself. That could be done by using two different accounts and mount points for the one share. Or by having two separate shares available on the server.
Windows 10 Pro x64, Windows 11 Pro x64
GT19
Junior Member
Junior Member
Posts: 6
Joined: 2020-11-06, 09:53 UTC

Re: Run TC in read-only mode, is it possible?

Post by *GT19 »

As far as I know It is not possible to mount a share in read-only mode in Windows if my user account has write access to it.
But key remapping is actually a good idea.
I think I will remap all dangerous keys (Del, F8, F6, F5) to something harmless, like minimize TC.
Thanks.
User avatar
nsp
Power Member
Power Member
Posts: 1925
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: Run TC in read-only mode, is it possible?

Post by *nsp »

GT19 wrote: 2020-11-08, 23:06 UTC I think I will remap all dangerous keys (Del, F8, F6, F5) to something harmless, like minimize TC.
You can launch TC with a dedicated ini File for your "Read Only" mode adding some color scheme to point current mode.
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Run TC in read-only mode, is it possible?

Post by *Stefan2 »

GT19 wrote: 2020-11-08, 23:06 UTC As far as I know It is not possible to mount a share in read-only mode in Windows if my user account has write access to it.
But key remapping is actually a good idea.
I think I will remap all dangerous keys (Del, F8, F6, F5) to something harmless, like minimize TC.
Thanks.

cm_Minimize ; Minimize Total Commander
cm_Maximize ; Maximize Total Commander



For example you can map that keys to one of this internal commands:
cm_HelpIndex ; Help index
cm_Keyboard ; Keyboard help
cm_About ; Help/About Total Commander

Or to
cm_UserMenu987 ; Start 987th menu item in Start menu >> shows an error message if there is no such item defined

You can try that commands by executing them from TCs internal command line at the bottom of TCs window.


Or create an own UserDefinedCommand named maybe "em_Disabled" which launch e.g. a VBScript
which shows an MsgBox, or an PopupMsg with an automatic timeout.



 
GT19
Junior Member
Junior Member
Posts: 6
Joined: 2020-11-06, 09:53 UTC

Re: Run TC in read-only mode, is it possible?

Post by *GT19 »

I managed to create my safe configuration with certain risky keys remapped and colors set to indicate the active configuration.
I am wondering if it is possible to load this (or the "normal") configuration without restarting TC?
Is there an internal command for this that I could run by assigning a toolbar button to it?
It would be really nice to be able to switch between these 2 setups by just pressing a button instead of restarting.

Thanks.
User avatar
Dalai
Power Member
Power Member
Posts: 9974
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Run TC in read-only mode, is it possible?

Post by *Dalai »

Well, I'd just create another desktop link or TC button that starts another TC instance with the second wincmd.ini. No restart necessary, just another instance. See my first answer in the thread for a command that does this.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
GT19
Junior Member
Junior Member
Posts: 6
Joined: 2020-11-06, 09:53 UTC

Re: Run TC in read-only mode, is it possible?

Post by *GT19 »

The problem with this "other instance" approach is that while working I usually have multiple drives/shares/folders open on both sides of TC in different tabs. If I start a new TC instance I have to recreate all those tabs and reopen the same respective resources in all of them.
So my question remains: Is it possible to load a set of settings into TC from a pre saved config file while running?
Like it is possible to change settings from the configuration dialog "on the fly", but only manually, one by one.
It would be nice to be able to read up the desired settings from a file not just when TC is started, but also while running.

Thanks
User avatar
Dalai
Power Member
Power Member
Posts: 9974
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Run TC in read-only mode, is it possible?

Post by *Dalai »

I don't think these changes can be made while TC is active.

Save your tabs as a separate .tab file (context menu of the tabs or SAVETABS or similar commands) and load them in the new instance (OPENTABS/APPENDTABS command). If you don't need any tabs but just the active directories in both panels the following command can be used:

Code: Select all

"%COMMANDER_EXE%" %Z%X "%P" "%T"
(you'd need to add the /i parameter from my post above to make TC use a different INI file)

Another approach is to redirect the [LeftTabs] and [RightTabs] sections to a common INI file that is shared by your regular wincmd.ini and your work.ini (as I called it above). Once that's done, a user-defined command (em_*) can be added that saves the current settings (which includes all open tabs) and launches another TC instance with a different INI file afterwards. Look in TC's help about RedirectSection - that can get you started on that possible solution.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
petermad
Power Member
Power Member
Posts: 16034
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Run TC in read-only mode, is it possible?

Post by *petermad »

2GT19
usually have multiple drives/shares/folders open on both sides of TC in different tabs. If I start a new TC instance I have to recreate all those tabs and reopen the same respective resources in all of them.
If you want setings like that to be common to both your totalcmd.ini file and your secure version of the ini file, you have to redirect those setiing to a third ini file in both of the ini files. It would be sections like these that should be redirected:

[left]
[right]
[lefttabs]
[righttabs]
[activetabs]
[RightHistory]
[LeftHistory]

For example:
[left]
RedirectSection=history.ini

Here is what I redirect of personal settings:
Spoiler

Code: Select all

[attrplugin]
RedirectSection=history.ini

[rename]
RedirectSection=history.ini

[SyncOptions]
RedirectSection=history.ini

[Selection]
RedirectSection=history.ini

[SearchName]
RedirectSection=history.ini

[SearchIn]
RedirectSection=history.ini

[SearchText]
RedirectSection=history.ini

[RenameTemplates]
RedirectSection=history.ini

[RenameSearchFind]
RedirectSection=history.ini

[RenameSearchReplace]
RedirectSection=history.ini

[left]
RedirectSection=history.ini

[right]
RedirectSection=history.ini

[lefttabs]
RedirectSection=history.ini

[righttabs]
RedirectSection=history.ini

[Command line history]
RedirectSection=history.ini

[RightHistory]
RedirectSection=history.ini

[LeftHistory]
RedirectSection=history.ini

[MkDirHistory]
RedirectSection=history.ini

[NewFileHistory]
RedirectSection=history.ini

[TargetList]
RedirectSection=history.ini

[PluginDuplicates]
RedirectSection=history.ini

[DirSelection]
RedirectSection=history.ini

[activetabs]
RedirectSection=history.ini

[ButtonbarCache]
RedirectSection=history.ini
You can use a button like this to load your secure ini file:

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_EXE% /N /i="%COMMANDER_INI%\..\secure_tc.ini" /f="%COMMANDER_INI%\..\secure_tc_ftp.ini"
%Z%X "%P" "%T"
%COMMANDER_EXE%
Open secure Total Commander


-1
Where secure_tc.ini and secure_tc_ftp.ini are your secure settings for TC''s main and ftp settings - which are placed in the same dir as your nornal totalcmd.ini file.
To make the button:
1. Mark the text in the box here above (click SELECT ALL).
2. Copy it to the ClipBoard (press Ctrl+C).
3. Right click on TC's buttonbar and choose "Paste".
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Post Reply