Apple Intelligence now features Image Playground, Genmoji, Writing Tools enhancements, seamless support for ChatGPT, and visual intelligence.

Apple Intelligence has also begun language expansion with localized English support for Australia, Canada, Ireland, New Zealand, South Africa, and the U.K. Learn more >

You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

how to lock screen after autologin

i have plex media server running on my imac. it requires a person to be logged in for the application to start. to have plex start upon reboot, i have set autologin turned on. Now I am trying to have the screen lock once autologin is complete, or as soon as possible.


I'm running Big Sur


thank you

iMac Line (2012 and Later)

Posted on Apr 3, 2021 1:24 PM

Reply
20 replies

Apr 3, 2021 8:19 PM in response to helicopter

helicopter wrote:

plex doesn't and won't start as a service. it needs access to drives, etc. i've already been down that road.

I'm sure there is a way to do it if you research it enough although it may require you to piece it all together. I'm not saying it will be easy, but it should be possible. I've seen a few references to doing this with other items (not Plex). I don't see how it would not have access to drives (again it may take some research and some critical thinking to put the pieces together and make it work). I think you will need to learn more about the low level aspects of how macOS works.


If you want something customized, then you should be willing to try to figure it out from the pieces of useful information posted here. I've made a couple of Applescripts over the years without knowing a thing about Applescripts or much about the inner workings of macOS by reading the Apple documentation and searching online for posts that deal with something similar I want to do, then I figure it out by making modifications to what I've found. It does require trial and error. You are not always going to be presented with an exact solution especially if your situation is unique.


How are other people with Plex media servers getting it to work on macOS? Have you checked on forums dedicated to Plex servers?


it appears this may not be the correct group to post this. is there a better location that i should post, where people would know how to write script?

Maybe here:

https://discussions.apple.com/community/mac_os/mac_os_x_technologies


Or better yet on a forum dedicated to Plex servers?


It may have helped if you actually mentioned "Plex Server" in the title of your post as well since many people may not even read your post since it only mentions auto login and lock screen.


Apr 3, 2021 3:51 PM in response to helicopter

to lock my screen on demand, i have set up a "hot corner"

go into SystemPreferences>Desktop&Screensaver in the screensaver tab and click "hot corners".


then you can set one of the "active screen corners" to "lock screen".


you can see by my example that i have the lower right box set to "lock screen". when i bring my cursor to that corner of the screen, it locks the screen. then the running apps keep running but can't be observed until you unlock it again with your admin password. you can set it for any corner you choose.


Apr 3, 2021 5:11 PM in response to jeffreythefrog

auto-login is turned on. my question was how do i make the mac automatically lock when it is logged in, like immediately lock or as close to that as possible to the computer logging on


i could set the screensaver to lock after a minute of inactivity, but that will give someone time to work. also if i set the screensaver to lock really fast, it won't even give me much time to think.

Apr 3, 2021 6:06 PM in response to jeffreythefrog

Then create an AppleScript to automatically turn on screensaver as one of the Login items. How you do this specifically I don't know since I've rarely used Applescript. That will be as fast as the action can be accomplished, but it may not be instantaneously. That is the risk of auto-login. Why not start Plex as a Startup Item or service instead which should not require automatic login. Again I don't know how to do this on macOS, but it should be possible and would be the best way.

Apr 3, 2021 7:07 PM in response to Jack-19

i don't understand what you mean by "are you not reading the OP's posts"


maybe you could explain what energy saver would do? that would only put the mac to sleep, correct? it wouldn't do any media serving asleep.


the lock part you gave me is what i already discussed. this would not work, because if someone is moving the mouse, it will never lock. a lock script, even from a terminal window, would lock the screen no matter what the person is doing.

Apr 3, 2021 8:33 PM in response to HWTech

i have plex working. the issue is NOT with the plex server; therefore, there is no need to mention it in the title. the mention of plex was only for additional information. it appears it is just too much info.


the title is correct. how to lock the screen after autologin. that is the question.


i did a scan for the same question on the link you gave, thank you, but nothing there either. Unless you are better at searching.


so where would i post my question on how to autolock a screen or lock a screen from a terminal window?

Apr 4, 2021 10:07 AM in response to helicopter

helicopter wrote:

i have plex working. the issue is NOT with the plex server; therefore, there is no need to mention it in the title. the mention of plex was only for additional information. it appears it is just too much info.

the title is correct. how to lock the screen after autologin. that is the question.

Obviously it does matter since you rejected at least one solution which I provided because according to you it won't work with Plex. My one solution bypasses the whole auto login issue which would be a better solution as it gives no one an opportunity to intercept the unlocked system, but it may require more research into how to implement it (or a similar solution) to work properly with Plex.

i did a scan for the same question on the link you gave, thank you, but nothing there either. Unless you are better at searching.

The link was for providing you a better location to post your question. While I have seen a few mentions of Plex on the Apple forums in general I've never seen many posts. The forum link I provided is an area where they tend to discuss macOS technology and scripts including Applescripts which is what you were asking assistance for.


so where would i post my question on how to autolock a screen or lock a screen from a terminal window?

Except for the link I provided already I don't think you will do any better on these Apple forums. You may find better luck on one of these forums, but they may only provide you general ideas to get you started as they expect you to do some of the leg work yourself although I think asking on the Plex server forums would yield the best results on how to properly configure the system to securely run Plex which is basically your real question here:


https://apple.stackexchange.com


https://stackoverflow.com/questions



Apr 4, 2021 1:35 PM in response to HWTech

i have no idea which suggestion i passed on. was it that plex should run as a service? if that's the one, it wasn't me rejecting it, but the software developer rejecting it. i also had done research on this problem over a week before i posted. others on the plex group say running as a service has many issues and have asked plex to have it run as such.


as for the link, i've looked for the exact wording, and the only thing i have found on apple, and the stackexchange and stackoverflow sites all contain posts from many years ago. none of the links i've found don't work because the applications no longer exist on the latest version of osx. that is why i posted, because i thought it was an area that needed a much more recent question that may have a more modern operating system solution. my old powerpc did work with those recommendations, and that is what i used on that old powerpc.


thank you again for the ideas, but i was not able to find anything on those sites before i asked my question and after you suggested it - i did look again. thank you for your time.

Apr 4, 2021 2:20 PM in response to helicopter

You need to search for how to use AppleScript to launch the screensaver immediately and place the script in the Login Items. AFAIK, this is the only option you have to meet the requirements for the subject of your post. Whether that is sufficient I don't know.


I don't know enough about the lower level or inner workings of macOS to provide any more specific guidance here. I've also only used Applescript a few times over the years so I don't recall how to do anything with it without research which I am not going to do as I don't have the time or interest/motivation to do so at this time. Since no one else is responding, I think you are going to have to learn the lower level and inner workings of macOS and scripting (BASH or Applescript) to solve the problem on your own. You've been given the seeds, now you must nurture them into a solution. Maybe as you research our suggestions you will come up with another way to achieve the desired result.


It is highly unlikely you are going to find an exact solution, so you will need to figure out how to use Applescript to activate the screensaver immediately. There are lots of examples online for using Applescript to launch another application, utility, or script so that should not be difficult to figure out. The slightly more difficult part will be having Applescript direct the screensaver app to immediately activate and lock the Mac, but I'm fairly sure this can be figured out if you learn how to use Applescript and learn more about the screensaver app. Of course there may be other lower level methods to achieve this, but I believe it will be more difficult to find the necessary information.


Good luck.

how to lock screen after autologin

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.