In my Redhat 6 Machine, I have 5 users: "user1", "user2", "user3", "user4", "user5". When I am logged in as "user1" or "user2", I want to disable right click on the Desktop but when I'm logged in as "user3" or "user4", then I want to be able to right click on the Desktop normally.

I tried xmodmap -e "pointer = 1 2 99 3 4 5 6 7 8 9", but it's blocking system-wide right clicking while I just want it blocked on the Desktop.

enter image description here

  • 1
    Could you elaborate a little bit on why you want to do this? Are you trying to prevent user1 and user2 from performing certain actions, either for security or "simplicity"? (Is this, for example, for some kind of a kiosk system?) Or is the context menu perhaps popping up when you don't want it to (an annoyance)? (This happens with my laptop touchpad, so I disable the touchpad.) I ask because the solution may well depend on the underlying reason you want to do this, and I'd hate to provide an answer that doesn't solve your actual problem. Jan 2, 2016 at 17:49

1 Answer 1


You can use:

xmodmap -e 'pointer = 1 2 25 4 5 6 7 8 9'

in order to disable the right button of your mouse (setting the third number to value higher then 10 bind the right button to no action). Put this line in the .bash_profile of the user you want to block the right click use

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .