0

I have a server that a few people log in to but I realized that when checking with last and lastlog that it doesn't list ssh done with VSCode but it works for people who use the terminal. How can I see when people have logged in via VSCode similar to last/lastlog?

5
  • You might be able to find them in /var/log/auth.log, but I don't think there's a ready-made tool (other than grep/sed/awk) to interrogate that, so not really similar to last/lastlog. Commented Jun 5 at 16:55
  • @tink Thanks for the suggestion. Though it seems like that isn't really logging it either. The only other alternative I could find was checking when the last time <user>/.vscode-server was modified. Which is modified every time they login. Commented Jun 5 at 18:16
  • Bummer ... I don't use VSCode at all, so have no means of checking how it communicates/authenticates ... Commented Jun 5 at 18:24
  • Same here. Kinda annoying that it does it's own thing rather than following the standard here. Commented Jun 5 at 18:27
  • following up on this (I've been thinking that there must be a built in way of logging this) ... Can you post your /etc/ssh/sshd_config in your question? I couldn't find anything about VScode, but it appears that many distros don't log sftp connections byh default. It might be that you just need to enable logging for sftp explicitly ... I'll add the respective line to my answer below. Commented Jun 7 at 18:01

1 Answer 1

1

Looking at your comment above, and seeing that you can determine from time-stamps on user files when they connected you should be able to create a systemd-service that utilises an inotifywatch on /home and logs all write-close access to said files (directories?) to a file under /var/log yourself...

[edit] As an afterthought - it's possible that VScode uses sftp under the hood, which doesn't get logged in many distros by default. If your /etc/ssh/sshd_config doesn't have a line like the following, try adding that and restart sshd (tweak the level if INFO is too garrulous):

Subsystem sftp  internal-sftp -f AUTH -l INFO

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.