Preventing accidental paste

In the last few days I’ve been working on production routers and more than once I’ve accidentally pasted commands into the terminal - either because I thought I’d copied the command I’d intended to the clipboard but hadn’t, or because my finger slipped and I accidentally pressed the middle mouse button.

I’ve made a shortcut (ctrl-alt-c) to clear the clipboard and I’m now in the habit of doing this before I copy the command into the clipboard, but this doesn’t prevent an accidental press of the scrollwheel.

Does anyone have any advice (besides slow down) to prevent this?

I'm debating between 1 shot of vodka in the morning or use safe mode if you feel unsafe while working with the mouse in RouterOS. Or some other combo.

Safe mode does help, but I’ve also lost count of the number of times I’ve forgotten to disable safe mode when I’m finished. But I guess I should use it more and just get out of that habit.

I’m all out of vodka, is scotch effective?

Depends what's approved at your workplace :sweat_smile:
On a more serious note, there are lots of things that don't like accidental pastes, so you have to find a more universal solution, disable scrollwheel ? since you've mentioned it as one the culprits.
Don't keep a terminal open unless you have to?
Paste in a notepad or something before doing it in the terminal?
Or some fancy clipboard manager, if you're clipboard doesn't contain RouterOS code, deny the paste in a winbox window for example. But the last ones require work.

Actually this is where Juniper and Palo alto excel you have to commit before it will take effect so finger slip is no longer an issue just my 0.002$

All good ideas. If I can figure out how to disable the scrolwheel acting as a middle button, that’ll help.

In this instance, I had the terminal open to copy and paste the current configuration from two routers into ChatGPT to ask it to compare and make sure they matched (not a straight diff, but they should behave the same way). I still had the config from the first router in the buffer and my finger slipped and it got copied into the second.

On my (Linux) system, when I try to paste a buffer with multiple lines of text including ENTER (carriage return) characters, it first displays a dialog with the buffer contents and asks if I am sure I want to paste that.

This is a feature that appeared at some time, I sometimes find it irritating, but I guess it is also good at some times. Indeed in the past I have sometimes pasted crap into a Linux shell window and created all kinds of weirdly named files that I then had to painstakingly delete.

Besides disabling pasting on scroll wheel click, for the cases where you really intend to paste something, but aren't sure that the clipboard has the "good" content, a trick is to type { first, then ENTER. Afterwards you can paste but whatever you paste will not execute right away. You can see and verify the content. If it is what you expect, add } and ENTER to close and run the block. If the clipboard content was wrong, press Ctrl+C to abort and none of the lines will be executed.

Teraterm does the same on a Windows box.

That’s brilliant, thanks!

The modern Windows Terminal (which is the default for Windows 11 and can be added from the Store for Windows 10) also does this.

$0.02 surely?

loloksi, are you recommending we change safe mode to a commit button, or add a commit button?

Both solutions have their pros and cons. But { … } is kind of like a “commit”, except that it lacks an automatic rollback when something halfway in a list of commands fails.

I’m MT will implement what others platform do that will be great as well, because safe mode is just a bandaid solution imho the advantage of this commit feature is you can validate what will going to change and prevent accident unfortunately there’s no concept on version control of configuration with MT

I’m dealing with a Palo firewall today. Commit takes ages. Don’t copy them :wink:

I have a managed switch made by a "trash" vendor ... and even they have another way implemented. It's half way to the "commit": when one makes configuration changes, they are commited immediately (just like they are with ROS). But they don't get saved to permanent configuration (unlike ROS). But it's not "safe mode" either as those changes persist until device is restarted. So then there's "save config" option ... which saves running configuration as permanent. But it does solve another class of problems than "commit".

So in short: I'm all in favour of some such solution. And I'm quite sure I'll sometimes fail to make necessary steps ... whatever they are (I often forget to hit that "save config" button on the other switch ... and then I'm caught by surprise if that switch reboots after a few years ...

That’s the way Cisco does it. I’m not a fan of that - I’ve lost count of the number of times a network has worked fine until a power failure and then the device reverted itself to previous configuration because the tech didn’t hit save, and by the time it happens no-one remembers what was changed.

Please trust me without making me give an example,
but even "{" doesn't guarantee disaster...
If there's an error, all lines following the error will be executed immediately, without waiting the } end...

In which operating system or terminal?
I tried on Windows with Winbox 3.43,
but the middle mouse button doesn't paste anything...