On 10/14/22 08:03, Rowland Penny via samba wrote:> > > On 14/10/2022 15:44, David Mulder via samba wrote: >> On 10/14/22 8:21 AM, Peter Carlson via samba wrote: >>> This is only partly a samba question and more a AD/GPO question >>> >>> I would like to have it setup via GPO that users when logging into >>> windows run login.ps1 and when logging in to linux run login.sh >>> >>> I have found one solution requiring python to be installed and using >>> one python script to detect the os and then re-act appropriately. >>> However I dont want to install python on windows computers. I was >>> thinking something like if computer in Linux Servers logon script = >>> login.sh otherwise logon script = login.ps1, but I'm not quite sure >>> how to best do this.? Maybe there is already a wiki on this that I >>> can't find? >>> >>> >> You could use Samba's client group policy for the linux client: >> >> https://wiki.samba.org/index.php/Group_Policy#Startup_Script_Policies >> https://wiki.samba.org/index.php/Group_Policy#Script_Policies >> >> Only works if you enable it on the client also: >> >> https://wiki.samba.org/index.php/Group_Policy#Winbind >> > > It is either that or use Python or some weird script that is half bash > (without a shebang) and half .com > > Rowland >so I am assuming that these scripts are only run on linux systems, if so that takes care of it not running on windows. so if I then put a login script login.ps1 or login.bat it will run on windows, but still try to run on linux and fail? Peter PS: sorry for the mis-spelling in the subject, the brain -> finger interface has one wire a bit loose
On 14/10/2022 16:08, Peter Carlson via samba wrote:> > On 10/14/22 08:03, Rowland Penny via samba wrote: >> >> >> On 14/10/2022 15:44, David Mulder via samba wrote: >>> On 10/14/22 8:21 AM, Peter Carlson via samba wrote: >>>> This is only partly a samba question and more a AD/GPO question >>>> >>>> I would like to have it setup via GPO that users when logging into >>>> windows run login.ps1 and when logging in to linux run login.sh >>>> >>>> I have found one solution requiring python to be installed and using >>>> one python script to detect the os and then re-act appropriately. >>>> However I dont want to install python on windows computers. I was >>>> thinking something like if computer in Linux Servers logon script = >>>> login.sh otherwise logon script = login.ps1, but I'm not quite sure >>>> how to best do this.? Maybe there is already a wiki on this that I >>>> can't find? >>>> >>>> >>> You could use Samba's client group policy for the linux client: >>> >>> https://wiki.samba.org/index.php/Group_Policy#Startup_Script_Policies >>> https://wiki.samba.org/index.php/Group_Policy#Script_Policies >>> >>> Only works if you enable it on the client also: >>> >>> https://wiki.samba.org/index.php/Group_Policy#Winbind >>> >> >> It is either that or use Python or some weird script that is half bash >> (without a shebang) and half .com >> >> Rowland >> > so I am assuming that these scripts are only run on linux systems, if so > that takes care of it not running on windows. > > so if I then put a login script login.ps1 or login.bat it will run on > windows, but still try to run on linux and fail? > > Peter > PS: sorry for the mis-spelling in the subject, the brain -> finger > interface has one wire a bit looseI looked into this once, so I looked through my notes and found this at the time: https://stackoverflow.com/questions/17510688/single-script-to-run-in-both-windows-batch-and-linux-bash It is still there, just checked. I didn't get much further than that at the time, there was a change of direction. I would go with David's suggestion, it sounds easier. Rowland
On 10/14/22 9:08 AM, Peter Carlson via samba wrote:> so I am assuming that these scripts are only run on linux systems, if > so that takes care of it not running on windows. > > so if I then put a login script login.ps1 or login.bat it will run on > windows, but still try to run on linux and fail? > > Peter > PS: sorry for the mis-spelling in the subject, the brain -> finger > interface has one wire a bit loose >Windows logon scripts are not executed by Samba client group policy, so that's not a problem. FYI, Samba's user group policy is somewhat limited. User policies aren't executed by samba by default, but need to be run some other way (I'm working on fixing this though). You can either enable them using oddjob-gpupdate: https://github.com/openSUSE/oddjob-gpupdate Or you can manually run the samba-gpupdate command via bashrc, or something: /usr/sbin/samba-gpupdate --target=User -U $USER Script Policies (https://wiki.samba.org/index.php/Group_Policy#Script_Policies) can be assigned as user policies, but the Startup Script Policies cannot (these are for the machine). So it depends on what your needs are. You could potentially run a machine Startup Script, which applies policies for all your users, etc. That would be the simplest setup. I'm happy to help if you run into any problems. -- David Mulder Labs Software Engineer, Samba SUSE 1221 S Valley Grove Way, Suite 500 Pleasant Grove, UT 84062 (P)+1 385.208.2989 dmulder at suse.com http://www.suse.com