0

What will happen to a file if I login two times with same user and make some changes to it?

Lets say I have logged in with username: goodguy in machine wonderland and editing a text file: pit and I take a ssh session from machine to this user goodguy in machine wonderland from a remote machine thieveland, and edit the same file - what are the semantics involved. The machine is linux.

I am trying to understand the user-session handling in linux kernel.

vanangamudi
  • 673
  • 1
  • 8
  • 21

1 Answers1

0

First of all let assume, that your "text editor" is very simiple program, it just get what you print and write this to file, and every time when you command "save", it rewrite content of file.

With such editor it is not important, you have two "user-sessions" or just open the same "text editor" with the same file in two windows.

And the result: content of "pit" is equal to last save.

fghj
  • 8,898
  • 4
  • 28
  • 56
  • so it is the responsibility of the editor itself to ensure that there will be no erratic saves to the file? – vanangamudi May 20 '15 at 09:16
  • Yes, almost all editors check that file was changed after they read them and ask user what to do. – fghj May 20 '15 at 09:30