Monday, May 01, 2017

Limit number of unix logins

#!/bin/sh
limit=3

session=`ps -ef | grep '\-sh' | grep $USER | grep -v grep`
number=`echo $session | wc -l`

if [ $number -ge $limit ]; then
echo "No more logins / Il n'y a plus de login. You are already logged as:
$session "

sleep 5
exit 0
fi

Monday, April 03, 2017

Forward all emails from one sendmail to another

- in sendmail.cf change Djdomain.tld to something like Dj_subdomain.domain.tld Do the same thing for DMdomain.tld
- in the same sendmail.cf look for Fw or Fw-o and check the file it refers to (usually /usr/lib/mail/local-host-names); in that file remove the line stating "domain.tld" (in fact, remove everything, leave just _subdomain.domain.tld there), that way sendmail will know that it is not the default destination for the @domain.tld

- if necessary, create /home/$username/.forward (chmod 600, chown $username:$group) and put the right info in it

Wednesday, March 01, 2017

Install mc on sco sysV unix

curl http://www.aljex.com/bkw/sco/mc.tar.bz2 |bzcat |tar xvf -
(there is a copy of that archive in my /update directory)

in .profile add PATH=$PATH:/usr/local/bin:/usr/local/sbin

Wednesday, February 01, 2017

Dell Latitude Keyboard light

The backlit keys interface seems to be broken, so you need to mask the controlling service: systemctl mask systemd-backlight@leds\:dell\:\:kbd_backlight.service
then go to BIOS and and change the keyboard led timeout from 10s to 5s for AC Power and Battery mode - "For some reason if the kbd_backlight service is not masked, it somehow forces the bios led timeout back to 10s, and then the keyboard led always remains lit."

Tuesday, January 03, 2017

TS - FR keyboard by default

Keyboard
Data collected on: 4/21/2015 1:44:16 PM
General
Details
Domain
domain.local
Owner
DOMAIN\Admins du domaine
Created
4/21/2015 1:32:00 PM
Modified
4/21/2015 1:42:44 PM
User Revisions
18 (AD), 18 (sysvol)
Computer Revisions
1 (AD), 1 (sysvol)
Unique ID
{0E240A4C-8A26-4761-8907-DB164F024AFC}
GPO Status
Enabled
Links
Location
Enforced
Link Status
Path
TS
No
Enabled
domain.local/Member Servers/TS

This list only includes links in the domain of the GPO.
Security Filtering
The settings in this GPO can only apply to the following groups, users, and computers:
Name
NT AUTHORITY\Authenticated Users
Delegation
These groups and users have the specified permission for this GPO
Name
Allowed Permissions
Inherited
NT AUTHORITY\Authenticated Users
Read (from Security Filtering)
No
NT AUTHORITY\ENTERPRISE DOMAIN CONTROLLERS
Read
No
NT AUTHORITY\SYSTEM
Edit settings, delete, modify security
No





No
Computer Configuration (Enabled)
Policies
Administrative Templates
Policy definitions (ADMX files) retrieved from the local machine.
System/Group Policy
Policy
Setting
Comment
User Group Policy loopback processing mode
Enabled
Mode:
Merge
User Configuration (Enabled)
Preferences
Windows Settings
Registry
2 (Order: 1)
General
Action
Update
Properties
Hive
HKEY_CURRENT_USER
Key path
Keyboard Layout\Preload
Value name
2
Value type
REG_SZ
Value data
00000409
Common
Options
Stop processing items on this extension if an error occurs on this item
No
Run in logged-on user's security context (user policy option)
No
Remove this item when it is no longer applied
No
Apply once and do not reapply
No
1 (Order: 2)
General
Action
Update
Properties
Hive
HKEY_CURRENT_USER
Key path
Keyboard Layout\Preload
Value name
1
Value type
REG_SZ
Value data
00000c0c
Common
Options
Stop processing items on this extension if an error occurs on this item
No
Run in logged-on user's security context (user policy option)
No
Remove this item when it is no longer applied
No
Apply once and do not reapply
No
ShowStatus (Order: 3)
General
Action
Update
Properties
Hive
HKEY_CURRENT_USER
Key path
Software\Microsoft\CTF\LangBar
Value name
ShowStatus
Value type
REG_DWORD
Value data
0x4 (4)
Common
Options
Stop processing items on this extension if an error occurs on this item
No
Run in logged-on user's security context (user policy option)
No
Remove this item when it is no longer applied
No
Apply once and do not reapply
No
Label (Order: 4)
General
Action
Update
Properties
Hive
HKEY_CURRENT_USER
Key path
Software\Microsoft\CTF\LangBar
Value name
Label
Value type
REG_DWORD
Value data
0x0 (0)
Common
Options
Stop processing items on this extension if an error occurs on this item
No
Run in logged-on user's security context (user policy option)
No
Remove this item when it is no longer applied
No
Apply once and do not reapply
No
AutoAdjustDeskBand (Order: 5)
General
Action
Update
Properties
Hive
HKEY_CURRENT_USER
Key path
Software\Microsoft\CTF\MSUTB
Value name
AutoAdjustDeskBand
Value type
REG_DWORD
Value data
0x0 (0)
Common
Options
Stop processing items on this extension if an error occurs on this item
No
Run in logged-on user's security context (user policy option)
No
Remove this item when it is no longer applied
No
Apply once and do not reapply
No

Thursday, December 01, 2016

SCO SysV Cannot enable remote printing (mkdev rlp) after the installation of an Update Pack 2/3 or a Maintenance Pack

"Unable to get complete data for 'Printer Manager on ...
Failed to retrieve list of remote printers.    
The TCP/IP rlp remote printing package is not installed...."
According to the documentation of Update Pack x and Maintenance
          Pack x, "mkdev rlp" MUST be run before applying Update Pack x or
          when including CUPS as part of the installation of the Maintenance
          Pack as detailed in:
         
          CUPS and Remote Printing (LPD)
         
          Although CUPS supports LPD as both a server and a client, the CUPS
          LPD server implementation does not support access control (based on
          the settings in the /etc/hosts.equiv and /etc/hosts.lpd files).
          If your setup requires the use of the standard LPD, or you wish to
          use access control, do not install CUPS.
WARNING  If you have never run mkdev rlp and you wish to do
          so, the CUPS package must be removed before running mkdev rlp
          and then reinstalled after remote printing is configured.
on a system-wide basis in /etc/default/lpd. The default entry is
            for the SYSV print system:

            PRINT_SYSTEM=SYSV


NOTE:
          If you already had run "mkdev rlp" and have added the Maintenance
          Pack and are now unable to run "scoadmin printer" -> Printer ->
          Add Remote (ie. (UNIX) ) is not able to be highlighted to add new
          Remote Printers then the cause is /usr/lib/mkdev/rlp is missing.

          The file 'rlp' is kept in /usr/lib/lp/sysv/save and can be copied
          back to /usr/lib/mkdev/rlp

          This issue has been reported to SCO Engineering.

NOTE:
          If you need CUPS to be removed in order for you to use LPD as
          detailed above in the Maintenance Pack installation notes BUT also
          require SAMBA to be used then please note that the removal of CUPS
          will also remove a number of libraries vital to Samba from /usr/lib:

          libcups.a@
          libcups.so@
          libcups.so.2@
          libcupsimage.a@
          libcupsimage.so@
          libcupsimage.so.2@

          Which should be copied and placed back into /usr/lib after CUPS has
          been removed in order for SAMBA 3.0.20A to function otherwise you
          may see:

          # /etc/init.d/smb start
          dynamic linker : /usr/sbin/smbd : could not open libcups.so.2
     

Tuesday, November 01, 2016

DR/Migrate Sco SysV

1)      Reinstall SCO Base system
2)      Copy /etc/conf to a backup directory (ie: copy –ormv /etc/conf /usr/rcvr/conf)
3)      Remove all contents of /etc/conf (cd /etc/conf && rm –r /etc/conf/*)
4)      Change file creation mask on root filesystem (cd / && umask 0)
5)      Restore tape excluding /dev & /stand (cpio –icvdmufB< /dev/rStp0 “dev/*” “stand/*” )
6)      Copy ttytype & inittab to backup directory (ex: cp /etc/inittab /usr/rcvr/ )
7)      Use SCOadmin to relink the kernel
8)      If asked to rebuild environment answer (y)YES
9)      Put back inittab & ttytype form the backup (ex: cp /usr/rcvr/inittab  /etc/inittab)
     10)     Reboot & have a Beer

Thursday, October 20, 2016

11

Totally forgot

Monday, October 03, 2016

Put the backup on a remote tape via ssh

#backup
   tar --verbose --exclude=/proc --exclude=/sys --exclude=/tmp --exclude=/mnt --totals -b2048 -jcpvf $SRC | ssh root@192.168.1.201 $(mt -f /dev/st0 rewind; cat > /dev/st0)

#restore
ssh root@192.168.1.201 "cat /dev/st0" | tar --exclude=/proc--exclude=/sys --exclude=/tmp --exclude=/mnt --totals -b2048 -jxpvf $DES

Thursday, September 01, 2016

CMD tmpwatch / logwatch

@echo off
:: (c)2015 s@toXX.guru

set watchdir="C:\Program Files\Research In Motion\BlackBerry Enterprise Server\logs"

:: remove older files
forfiles /p %watchdir% /s /m *.* /c "cmd /c Del @path" /d -30
:: remove empty folders !!! cd on a different drive first, if that's the case !!!
:: D:\
cd  %watchdir%
for /f "tokens=*" %d in ('dir /ad/b/s ^| sort /R') do rd "%d"