I have vps for personal goals. Vps running on ubuntu 16.04 x64.
I'm config ssh to login only by my one user (schumi) by public key (login by password and login by root are disabled). If I needed change any config or install package, I'm did: su -
and login by root with password.
But sometimes I want to see logs (/var/log) and ofcouse can not did it:
drwxrwxr-x 6 root syslog .
drwxr-xr-x 12 root root ..
-rw-r--r-- 1 root root alternatives.log
drwxr-xr-x 2 root root apt
-rw-r----- 1 syslog adm auth.log
-rw------- 1 root utmp btmp
-rw-r----- 1 root adm dmesg
-rw-r--r-- 1 root root dpkg.log
-rw-r--r-- 1 root root faillog
-rw-r--r-- 1 root root fontconfig.log
drwxr-xr-x 2 root root fsck
-rw-rw-r-- 1 root utmp lastlog
-rw-r----- 1 syslog adm mail.err
-rw-r----- 1 syslog adm mail.log
drwxr-xr-x 2 root root proftpd
-rw-r----- 1 syslog adm syslog
-rw-r----- 1 syslog adm syslog.1
drwxrwxr-x 2 debian-transmission debian-transmission transmission
-rw-rw-r-- 1 root utmp wtmp
What's I do now? I login by ssh (schumi), then su -
and see logs.
But may be better add my user (schumi) to some groups? Or it's not secure?
Also, I have thoughts to view logs without login by ssh. For example, run telegram-bot on vps, enable conversation bot only with me and implements commands to send log files to me by specific commands. Or run, for example, nginx, config authentication and direct open log at web page...
If you created the user yourself, add it to the
adm
group:This will let the user read most of those logs.