[SOLVED]Choose different autologin-user depending on luks-keyslot used

I got two users on this system and both have a passphrase for the system encryption with luks. Now I want to build a script that changes the gdm settings at boot time to change the user that is going to be logged in automatically depending on which slot was unlocked.
I already changed /lib/initcpio/hooks/encrypt to include a "-v" when cryptsetup is called (so it gives the number of the slot to the output) and also changed the appropriate lines to
while ! CRYPTSLOT=$(/sbin/cryptsetup -v luksOpen ${cryptdev} ${cryptname} ${cryptargs} ${CSQUIET}); do
sleep 2;
done
which saves the output in the variable CRYPTSLOT.
Now I just need to export this variable somehow in a way that i can pick it up in some rc.d script (at a time when the filesystems are mounted etc.). I tried just
export CRYPTSLOT
, which did not work. Saving it to a file will also not be possible since the hook is run before / is mounted, in the initramdisk. Is there any other possibility? Can I write it to some file in /boot? (is it mounted?)
I also tried it without a variable, extracting the information from dmesg or /etc/messages.log, but it wasn't there. If I do not save it in the variable I see it in the boot screen, but I can not pass it to some later script.
Last edited by viktordick (2012-03-25 15:34:34)

The output is put to stdout, not stderr. Is msg some function inside the initramfs? Because bash does not find the command, but if I put it into the hook, it acts the same way as echo. Its argument still does not appear in dmesg.
Well, I found another way: I wrote the output to /dev/cryptslot. /dev is already there and it seems it is also writeable. So in /lib/initcpio/hooks/encrypt I have
while ! /sbin/cryptsetup -v luksOpen ${cryptdev} ${cryptname} ${cryptargs} ${CSQUIET} > /dev/cryptslot; do
sleep 2;
done
and then I created a script in /etc/rc.d/changeuser:
#!/bin/bash
case "$1" in
start)
SLOT=$(cat /dev/cryptslot | cut -d ' ' -f 3)
case $SLOT in
0) cp /etc/gdm/custom-user1.conf /etc/gdm/custom.conf;;
1) cp /etc/gdm/custom-user2.conf /etc/gdm/custom.conf;;
esac
stop)
restart)
$0 stop
sleep 1
$0 start
echo "usage: $0 {start|stop|restart}"
esac
exit 0
Of course, this has to be added to /etc/rc.conf, too. Preferably before gdm and not in background.
Maybe this ist not such a good solution since /dev is not the right place for this. /proc might be better, but I cannot write anything there.
And yeah, the changes in /lib will probably be overwritten, but they are few, I can redo them when neccessary.

Similar Messages

  • [Solved] Running mpd as user mpd with systemd without using mpd.conf

    Maybe this is tivial, but I searched about an hour without any results. I want to run mpd as user mpd. I cant use the mpd config file since mpd set the UID and GID explicitely resulting in mpd not having the necessary supplementary groups to access the locally shared music on my pc. Well I tried to run mpd with systemd by
    # systemctl start mpd
    and  the systemd contains the user mpd
    $ cat /etc/systemd/system/default.target.wants/mpd.service
    [Unit]
    Description=Music Player Daemon
    After=network.target sound.target
    [Service]
    User=mpd
    ExecStart=/usr/bin/mpd --no-daemon
    # allow MPD to use real-time priority 50
    LimitRTPRIO=50
    LimitRTTIME=-1
    # move MPD to a top-level cgroup, as real-time budget assignment fails
    # in cgroup /system/mpd.service, because /system has a zero real-time
    # budget; see
    # http://www.freedesktop.org/wiki/Software/systemd/MyServiceCantGetRealtime/
    ControlGroup=cpu:/mpd
    # assign a real-time budget
    ControlGroupAttribute=cpu.rt_runtime_us 500000
    [Install]
    WantedBy=default.target
    but it did not run as mpd.
    Well how can I run mpd as mpd? Is there a way to do it like with dropbox: dropbox@<user>.service
    Last edited by manuelschneid3r (2015-03-25 12:52:52)

    Glad you solved it. Was just typing a response and I'll still add two remarks:
    The ps|grep output showed that you run grep as root, not mpd itself (which won't have a space in the command -- the second time it only worked because the mpd group is preceded by a space).
    It sounds like it took you a while to find the drop-in configuration snippet in the mpd.service.d directory. These drop-in are shown in `systemctl status`, which is something you'd normally check in situations like these, and that might help to discover them more quickly.
    Last edited by Raynman (2015-03-25 12:58:36)

  • Plot different data set depending of some conditions using labview and veristand

    Hi Community,
    i have a couple of points saved as XY data points on my desktop.  The files are save as csv.  the idea is to read the file utilizing the Read From Spreadsheet File vi when some conditions are met and then plot the XY data wiht XY Graph Addon of the veristand workspace.
    for instance:
    if case 1 is true read the corresponding file and then plot the first set of data
    if case 2 is true read the corresponding file and then plot the second set of data
    if case n is true read the corresponding file and then plot the n set of data.
    Could you give some advices how to implement it (Labview and Veristand)?
    I'm using LV and NIVS 2012
    Thx
    Mich
    Attachments:
    vide.vi ‏35 KB

    Hi Michel,
    I believe the easiest method will be to use the VeriStand .NET API to call into VeriStand and utilize LabVIEW for creating the decision making cases that you have.  I have attached some examples of using the VeriStand API in LabVIEW.
    Using the NI VeriStand .NET API in LabVIEW to Control a VeriStand System
    https://decibel.ni.com/content/docs/DOC-32268
    Where Can I Find LabVIEW Examples Using the NI VeriStand API?
    http://digital.ni.com/public.nsf/allkb/E1066949FA67B6CE862578A7005988D5?OpenDocument
    Please let me know if this helps.
    Matt S.
    Industrial Communications Product Support Engineer
    National Instruments

  • Call different RFC Functions depending on variable

    Hi,
    I have to implement following requirement:
    My program generates a report for the user and the user can choose which data he wants to have.
    Depending on the user decissions, I have to use different RFC - Functions to get the data.
    I have the name of the RFC Function und I want to call the RFC Function with this name dynamically.
    For example:
    rfcName = "Z_FUNC_1";
    rfc = get the object for Z_FUNC_1 somehow. This is my problem
    rfc.execute();
    Is there any way how to solve this?  I know that I can solve this like this, but this is not the flexible way that i want:
    if (whichRFC == 1) {
      Z_Func_1_input rfc = new Z_Func_input();
    rfc.execute();
    Any ideas?
    Best regards,
    Peter

    Dear Peter,
    There are how many RFC models are you going to make? In my opinion it would be  too tedious and redundant as you have to create diifferent models fo each RFC.
    Instead of this you may create a single RFC and in that you can call your required RFC depending on the user selection.
    It will simplify your application as well as your task.
    Hope it helps!!
    Warm Regards
    Upendra Agrawal

  • How to display different Splash Screen depending on the Locale?

    Hi,
    I have a splash screen which is working fine.
    I want to display different spalsh screen depending on the locale the user has.
    Is this possible.
    I can display different Title,Description and the text of the short-cut icon on desktop and startup Menu based on the locale by mentioning it in the JNLP and altering my browser settings. I am not able to use the icon and splash screen corresponding to the specified locale. How to do this?
    EX:
    <information>
    <title> In english</title>
    <description> In english</description>
    <shortcut online="true">
    <!-- create desktop shortcut -->
    <desktop/>
    <menu submenu="My Project in English language"/>
    </shortcut>
    *<icon kind="shortcut" href="images/icon_english.gif"/>
    <icon kind="splash" href="images/splash_english.jpg"/>*
    <!-- locale="nl-NL" specifies dutch -->
    </information>
    <information locale="nl-NL">
    <title> In Dutch</title>
    <description>In Dutch</description>
    <shortcut online="true">
    <!-- create desktop shortcut -->
    <desktop/>
    <menu submenu="My Project in Dutch language"/>
    </shortcut>
    *<icon kind="shortcut" href="images/icon_dutch.gif"/>
    <icon kind="splash" href="images/splash_dutch.jpg"/>*
    </information>
    *Now here i am not getting the splash_dutch screen for the locale "nl-NL"(Dutch) and i am getting splash_english screen.
    Can we acheive this?*

    Hi anjali...
    I have problem with splash screen..
    here is my jnlp file
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="http://localhost:8080/MyProject">
         <information>
              <title>MyProject1.0</title>
              <vendor>none</vendor>
              <description>Application Launcher For MyProject1.0</description>
              <description kind="short"></description>
              <offline-allowed />
              <icon kind="splash" href="images/Splash_MyProject.jpg" width="560" height="300"/>
         </information>
         <resources>
              <jar href="SwingApplication/mysql-connector-java-5.0.6-bin.jar" />
              <jar href="SwingApplication/MyProject1.0.jar" main="true"/>
              <jar href="SwingApplication/liquidlnf.jar" />
              <j2se version="1.6+" java-vm-args="-Xms32M -Xmx256M " />
         </resources>
         <security>
              <all-permissions/>
         </security>
         <application-desc main-class="com.mobius.ui.MainWindow">
              <argument>production%0%3#com.mysql.jdbc.Driver#MyProject4%jdbc:mysql://10.100.1.89:3306/MyProject4%MyProject%info123#MyProject2%jdbc:mysql://10.100.1.89:3306/MyProject2%MyProject%info123</argument>
         </application-desc>
    </jnlp>my post is in
    http://forum.java.sun.com/thread.jspa?threadID=5298381
    http://forum.java.sun.com/thread.jspa?threadID=5298466
    I am in big problem Help me...
    Edited by: arunnprakash on May 22, 2008 1:28 PM
    Edited by: arunnprakash on May 22, 2008 1:28 PM

  • Are Sql functions different from user defined functions ?

    Hello,
    SQL functions are built into Oracle Database and are available for use in various appropriate SQL statements. Do not >confuse SQL functions with user-defined functions written in PL/SQL.according to first paragraph of this document Sql functions are different from user defined functions . How is that ?
    Is they really differ from each other ?

    bootstrap wrote:
    If you don't know what compilation is, please use Wikipedia or other online resources.I know what is compilation . But i was confused whether those sql functions are compiled in my machine when i install Oracle Database in my machine or they are pre-compiled .
    As you said these Sql functions are pre-compiled , it is clear now that they are pre-compiled platform dependent code .
    Can you provide actual source code of any SQL function , say SUM function .
    I want to see it, how they have defined . Eagerly waiting for any reply. please help .
    Edited by: bootstrap on Aug 19, 2011 11:50 AMYou can ask oracle if they give you their code. I doubt they will. However if you want to write you own user-defined aggregation function, there are examples in the documentation how to do that.
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17125/adfns_packages.htm#i1008575
    Edited by: Sven W. on Aug 19, 2011 9:24 AM

  • Choosing different versions of Flash Player in Flash Catalyst

    Greetings everyone,
    Is it possible to choose different version of flash player when I publish my  website using flash catalyst? Currently it is askinf for flash player 10.2 in order to  play. I want to lower down the version of flash player required in order to let  more users view my project.
    Thanks!
    James

    quote:
    Originally posted by:
    Darren McNally - Adobe
    Hi kidkwattro,
    There is an extension for Firefox called ‘Flash
    Switcher’.
    This extension allows you to switch from one version of Flash
    player to another. This is not an Adobe product, but it had
    received some good reviews on the web.
    This is an amazingly useful tool as a developer working a
    selection of sites which are all catered towards a different target
    age range (older people seem to have older versions installed).

  • Can I assign different Spry widgets depending on device?

    Using Fluid Grid Layout, is there a way I can display the same html in a Spry Accordian for phones only and a Spry Tabbed Panel for tablets and desktops?

    The mechanism that makes the Spry Accordion slide up and down when a user click each panel, in the image below, is different than the mechanism that makes a Spry Tabbed Panel switch from panel to panel when a user clicks each tab (image below this one).  This mechanism is called "Widget Behavior: JavaScript code that controls how the widget responds to user-initiated events."  It is my understanding that CSS only controls the look and style of something and not the way it behaves.  Again, I appreciate your attention to this matter but I am looking for a way to display the same html in a Spry Accordion for phones only and a Spry Tabbed Panel for tablet and desktops. This requires that I use different javascript code depending on device. I understand how to change the CSS depending on device.

  • I do not see where to enter IP addresses in the Open VPN setup. Also, how can I set it up so that I can choose different servers in the same way as I can currently choose them with my VPN app but for PPTP?

    I think I have it working on my iPhone 5. But, I do not see how I can control the exit point that I would like for the VPN. Are all the exit points shown in the VPN setting now going to work with Open VPN, or do they remain PPTP? If I am reading correctly, they look like they remain PPTP. If I cannot control the exit point for open VPN, which exit point is the default in the profile you provided me?I note that Open VPN Connect does not work with any of the new 64 bit devices like the iPhone 5S, the iPad Air, and the new iPad MIni. Is there any chance that you guys will come up with an update for your app so that open VPN can be made to work on all iOS devices? That would be nice, particularly if the Open VPN Connect app does not give me a choice of exit points.Thanks,
    I do not see where to enter IP addresses in the Open VPN setup. Also, how can I set it up so that I can choose different servers in the same way as I can currently choose them with my VPN app but for PPTP?
    Just a quick note to tell you that Open VPN has updated their app so that it is compatible with 64 bit ARM devices like the iPhone 5S, the iPad Air, and the iPad Mini Retina.That does not resolve the problem of how to easily choose among the various possibilities for the exit server. We need to find an easy way to choose.

    Thank you for trying the new Firefox. I'm sorry that you’re unhappy with the new design.
    I understand your frustration and surprise at the removal of these features but I can't undo these changes. I'm just a support volunteer and I do not work for Mozilla. But you can send any feedback about these changes to http://input.mozilla.org/feedback. Firefox developers collect data submitted through there then present it at the weekly Firefox meeting
    I recommend you try to adjust to 29 and see if you can't make it work for you before you downgrade to a less secure and soon outdated version of Firefox.
    Here are a few suggestions for restoring the old design. I hope you’ll find one that works for you:
    *Use the [https://addons.mozilla.org/en-US/firefox/addon/classicthemerestorer/ Classic Theme Restorer] to bring back the old design. Learn more here: [[How to make the new Firefox look like the old Firefox]]
    *Use the [https://addons.mozilla.org/en-US/firefox/addon/the-addon-bar/ Add-on Bar Restored] to bring back the add-on bar. Learn more here: [[What happened to the Add-on Bar?]]

  • How to sync 2 different Mac users using the same Apple ID and with out mixing each other info?

    How to sync 2 different Mac users using the same Apple ID and with out mixing each other info?
    We are two people using three difrent Macs, 1 Iphone and 1 Ipad with separate USERS  on each Mac but sharing the same Apple ID: xxxxxx
    I set up the first user to iCloud and it was OK but when I set up the second user to use iCoud the first users's info gets mixed with the second user's info?
    Do we have to set up a diffrent Apple ID for each other?
    Sometime ago I added my friends E mail (yyyyy) to the main Apple ID (xxxx) as for using his E mail account (to separate our e mail accounts, and it's working ok) but now when I try to create a new apple ID whith the same friend's e mail (yyyyyy)  it says that his mail (yyyyy) is already an apple ID when the Apple ID is really my E mail (xxxxx)... any clue?
    Thanks

    I believe because you migrated from a Nokia to an iPhone you need to register the Bn phone number with your Apple ID so it can be used for iMessage. The Pn number seems to be the only one registered
    Go here > https://appleid.apple.com/cgi-bin/WebObjects/MyAppleId.woa/
    Manage your Apple ID and see if that does the trick
    Hope that helps

  • How can we choose to have different apps, different playlists, different contacts, etc., on each device., while using one itunes to sync more than 1 iphone

    How can we choose to have different apps, different playlists, different contacts, etc., on each device., while using one itunes to sync more than 1 iphone

    Use Multiple Devices with One Computer
    How to use multiple iPods, iPads, or iPhones with one computer

  • Can I share addresses lists between 2 different iCloud users?

    Does anyone know if I can share address lists/books between two different iCloud users?  I know you can do this with a calendar, but I would like to do it with addresses too.

    Yes.
    Go to Settings -> Mail, Contacts, Calendars
    Add a new account if type iCloud, and username/pasword for the secondary account you want to access their contacts.  Turn off all but Contacts, and you wll now be seeing their contacts on your iPhone.
    Now in your contacts app, under Groups, there is a new section of contact from the new iCloud account you just setup.  If you have the contacts app open (even minimized) you may have to force it closed and re-open to sync in the new contacts.

  • Choose different audio tracks in PE10 full version possible?!

    Oky, I have tested this with Adobe PE10, but WHERE do I choose which audio track I want to import/use in the timeline?! Where can I see if the clip has more than 1 stream in Adobe Premiere Elements 10? I have tried looking in settings etc., but no luck. I KNOW that my video got 4 different audio tracks in it, but when I add the media to Adobe PE10 (it's a .m2ts-format file), only 1 stream (the DEFAULT audio stream, which is the WRONG stream) is what I get. Where are the other 3 audio streams, and how can I use them? It's nothing special about the clip itself. I can play the audio and video in the timeline, it just got the wrong audio stream...
    I am asking because I see many articles/posts that mention you can do this in PE10, but I don't understand where... So far I have yet to find ANY video editing software that supports this.
    And converting the audio FROM the .m2ts-file using a 3rd-party program is out of the question as well. If it does not work with PE10, then I have to find another solution, I suppose.

    You do not have the option of choosing between the main track and the dub track from a video clip in Premiere Elements, Goodie. You just get the main track. So if that's what you're talking about, you'll need to look elsewhere. Though I'm not sure where because I don't know ANY video software that does this. What makes you think it's even available?
    The exception is when you're shooting in 5.1 audio in AVCHD. If you've set your project up for 5.1 audio, you can control the level of each of the five tracks independently.

  • How to choose different SSO/OID resource name - when start application?

    Background
    We are new to 10g(10.1.2.0.2)
    We have an environment where we have a front end 10g application (set of screens, menus, reports etc) that we like to be able to run against different backends. Eg one database for one set of data and another database with a different set of data.
    We have several users and we created one SSO/OID account/username for each person and one resource type for each username/password@database that they need to have access to. We decided to name the resource type with the same name as the database – for ease of memory.
    The first time that a person logs on, enters their SSO u/p SSO asks the users for their “default” u/p@db – since the formsweb.cfg’s ssoDynamicResourceCreate=true. This creates yet another resource in SSO/OID for the user. From then on the people never get the option to go into one of the other databases – ie to use one of their other SSO/OID resources.
    We do not want any passwords to be written into the formsweb.cfg file.
    Question
    How can we get our people to use SSO to open their front end but be able to chose a “non default” resource to open the application against a different backend/database?
    Ta

    Oracle Forms can use only a resource with a name equal to the config section you are using to start your application. This in contrast to reports where the SSOCONN parameter can be used to differentiate between resources.
    The solution is to use a different config section for each environment. You can for example make an html page on which you have a link to all environments, each of these pointing to a url with a different config.

  • How to access Sharepoint List using a Different user. Access SharePoint List using some Authentication

    Hi,
    SharePoint version 2010
    I am building an application in Java and would want to accesss a SharePoint List through REST. I have been trying to find out how the authentication process would work once i want to deploy it into Production. 
    I am not able to find anything useful to send user detail / authentication. Can you please help me out here.
    Thanks,
    Bhaskar.
    Thanks, Bhaskar

    Hi,
    According to your post, my understanding is that you want to access SharePoint list from Java application through REST.
     In some cases you may need to create a new access token (this is somewhat akin to "running as a different user").
    Essentially, you are using a different user's security context. Typically, you would create an Active Directory account specifically for this purpose and then grant appropriate rights to the user account in SharePoint.
    http://sharepoint.stackexchange.com/questions/83440/authenticate-external-systems-against-sharepoint-rest-services
    There are some articles about this topic, you can have a look at them.
    http://stackoverflow.com/questions/10722215/authenticating-to-sharepoint-with-kerberos-from-a-java-httpclient
    http://ctp-ms.blogspot.com/2012/12/interoperability-between-java-and.html
    Thanks,
    Jason
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jason Guo
    TechNet Community Support

Maybe you are looking for

  • Upgrading a Mac Mini

    I recently acquired a Mac Mini belonging to my brother after he died.  His brother-in-law,  a computer programmer, wiped it clean and took it back to factory.  I'm confident he did it right.  Now I need to bring it up to the highest standard possible

  • Adobe Acrobat Reader 2.0 for Pocket PC (Windows CE 5.0 Core Edition)

    I have a PNA with Windows CE 5.0 Core Platform. If I start the Adobe Acrobat reader I get an error message (App or other components faild). Wich dll's and api's from the current Windows CE Platform I need to work this programm of my Windows CE Core P

  • Limiting Authorization of one of many UDF in marketing documents

    Hi I have created a Additional Authorization Creator for limiting the user from changing the values of  UDF Field and its working fine,  but the issue is i need to block only one UDF which i have created. For Eg. There are some 5 UDF (Header Level UD

  • Converting Standard Message to an Error Message

    Hello Experts, Is there a way I can convert an existing seeded Note Message to an Error Message. The intention is - at the time of termination, a note shows that the "The person is the Organization Manager for 10 Organizations.  Please use Organizati

  • Creating enterprise srtucture in CIN

    Hi Experts i am creating enterprise structure in CIN,but i am unable to create material ,but i am maintaining  all settings. please tell me steps while creating enterprise structure. "The company code 2222 does not exist or has not been fully maintai