Terminal set to an illegal value unable to fix - macos

im running a Snow Leopard 10.6.8 and today i tried running Terminal when i got an error which said.
"You are authorised to run this applicationThe Administrator has set your shell to and illegal value."I checked older posts and so far i have tried changing Terminals File Permissions,Changed /private/etc/shells to default and repaired permissions with disk utility. Does anyone know how to fix this.

It sounds like your user shell got set to an illegal value. To fix this:
Open System Preferences, and go to the Users and groups pane
Click the padlock and authenticate as an administrator
Right-click (or Control-click) on your user account in the sidebar, then choose Advanced Options from the shortcut menu that appears.
In the Advanced dialog, change your Login shell to "/bin/bash". DO NOT CHANGE ANYTHING ELSE.
Click OK to save the change, log out & back in, and try using Terminal again.

The default shell for your user will be set in /private/etc/passwd at the end of the line starting with your username. It should be set to /bin/bash

Related

How can I close a specific Xcode project, from the command line, without Applescript?

I'd like to close a specific Xcode project from the command line without closing any other projects (so I can't just use kill). Applescript is problematic in Catalina because of additional permissions needed. Is there any other way to do what I want?
If you want to use the Terminal to control other apps via AppleScript, you must give permission. But this is not difficult, because the system will prompt for the needed permission if you have not given it already.
For example, I just said
$ osascript -e 'tell app "Finder" to close window 1'
and I saw this dialog:
I clicked OK and the window closed, as ordered. No problem. So you'd see something like that for Xcode, you'd grant permission, and that would be that. The permission is recorded in the Security & Privacy pref pane under Automation.
If you prefer to pass thru System Events, the permission is recorded under Accessibility. Note that that is a permission you can grant in advance. But you still need to go thru the dialog so you can give Terminal permission to talk to System Events.
If you deny access in the dialog and you want to be asked again, use tccutil to reset the database. Good discussion here: https://apple.stackexchange.com/questions/384230/how-do-i-reset-screen-recording-permission-on-macos-catalina

Rename tab in MobaXterm for session duration

How can we rename tabs in MobaXTerm for the entire session duration? At the moment, I can right-click and rename the tabs, but as soon as I press enter to get command prompt, MobaXTerm resets tab name to its original default. I have tried changing PS1 env variable with no effect. Please help.
I haven't tried this myself but when you create a profile for a new ssh session, there is a tab "Bookmark settings" and within this tab there is a check box named "Lock terminal title." According to the manual:
Lock terminal title
Terminal title will be set to the session name
If you check this option, any attempt by the shell to set tab title will fail.
Uncheck this option if you want to allow the shell to change tab title.
Looks like you need to open every new tab as a New Session (Click on the "Session" button) and then follow what ks2000 suggested (It works for me).
There is limitation in number of sessions created for non-purchased mobaxterm. When you go for edit the session, red coloured message this message will be displayed. Delete unwanted sessions, unlock terminal title, then it will work. Otherwise purchase mobaxterm.
A bit late, but I came across this and wanted to update it.
I found the answer here:
https://stackoverflow.com/questions/29963545/rename-tab-in-mobaxterm-for-session-duration
I wrote a bash function to quickly handle this for me.
set_title() {
PROMPT_COMMAND="echo -ne \"\033]0;$1\a\""
}
set_title "webserver"
If none of the above works, just go to the sessions tab and click on the session you want to rename (just like when you want to rename a file). You should see the following:
After that, enter the preferred name and hit enter. The following window will occur:
Click yes and voilà!
THIS IS NOT FOR THE SESSION DURATION BUT PERMANENT

Passwd command in Single User Mode on OSX not working

I am currently trying to create a root account from Single User Mode on OSX Yosemite
/sbin/mount -uw /
launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist
passwd
The first 2 lines appear to work fine, but after I type 'passwd' nothing comes up. Not even a propmpt to keep typing commands. I don't believe it is setting the password because anything I type is visible and even if I type the same text twice nothing happens.
When I try to run this command after the computer boots and I have logged into my account 'passwd' works as expected, it prompts me for the old password and for the new password twice.
I had exactly the same issue, earlier today. However, there is another way:
Reboot your Mac then press & hold Command + R when it's booting up until you see a loading bar. You'll then be taken into recovery mode.
Recovery mode has a UI, so use your mouse and select Terminal from the Utilities section of the menu bar.
Type resetpassword in the terminal and hit Enter. This will load the password reset utility, where you can pick a user and give them a new password.

Disable "The last time you opened *, it unexpectedly quit while reopening windows" dialog in OSX 10.8

I managed to successfully silence the CrashReport dialog, but when my application crashes and I restart it, I get the annoying dialog as from Title. Is there a way to prevent it to appear, and just let the application run without interruption?
Try this to get rid of the reopening windows:
defaults write -app "Application Name" NSQuitAlwaysKeepsWindows -bool false
You may also disable it for every application by selecting this option in the preferences: "Close windows when quitting an application"
And for others reading this thread, to remove the CrashReport do this:
defaults write com.apple.CrashReporter DialogType none
Also note that in the source of this information they say:
For this to work one needs to check the box, open the program in
question and immediately close it. On the next re-opening it will work
without Resume.
You may also have to delete:
/Users/…/Library/Saved\ Application\ State/org.python.python.savedState/
I was having a similar problem with google chrome and I could solve it by reading the following link:
https://support.google.com/chrome/thread/22716083?hl=en
Drew Z recommends the following solution there which worked for me:
In the Mac menu bar at the top of the screen, click Go.
Select Go to Folder.
Enter ~/Library/Application Support/Google/Chrome/ in the text field, then press Go.
Locate the folder called "Default" in the directory window that opens and rename it as "Backup default."
Try opening Google Chrome again. A new "Default" folder is automatically created as you start using the browser.
Voila! I've just solved this problem by deleting all Unity-related files inside ~Library/Caches folder on my Mac!
For those trying to accomplish this
defaults write -app "Application Name" NSQuitAlwaysKeepsWindows -bool false
with Python, you may get the error Couldn't find an application named "Python"; defaults unchanged.
To solve this, repeat the process to get the "reopen windows?" pop-up again, but do not choose an option in the pop-up – leave it alone for now. Right-click on the Python application's icon on the dock and choose "Show in Finder". Right-click on the application icon within Finder, hold the option key, and click Copy "Python" as pathname". Paste that in as the "Application Name" for the command above and it should work.
You can disable this for a specific Xcode scheme by going to Edit Scheme, choosing the Options tab, and checking the box labeled "Launch application without state restoration."
However, this will only apply when you actually launch the application from Xcode; it won't disable the dialog when launching by double-clicking in Finder, or when launching from the terminal.
(As best I can tell, there no way for AppKit/NSApplication-based apps to do what UIKit apps can do with UIApplicationDelegate's application:shouldRestoreApplicationState: and disable persistent state entirely for the application.)

Stop CMD from always opening with administrator privileges

No matter how I open it, cmd.exe always opens with admin privileges. How can I open it without? Is there some registry setting missing? Even if I open it directly from the run dialog or by double clicking in the system32 folder it still opens with admin privs.
Thanks.
Found out I was missing a registry key. In HKEY_CLASSES_ROOT\Directory\shell\cmd I was missing the String Value "Extended". Added this back in and restarted the machine got rid of the defaulting to admin privileges.
EDIT: I had UAC turned off for my profile (to stop incessant "are you sure you want to open this .exe" warnings), and turning that back on has stopped cmd always running with greater privileges.
After some unclear actions (switch UAC on/off ?) I ended up in the same situation as described above:
Cmd.exe always starts in Adminstration mode.
Linking in VS failed with the message:
Project : error PRJ0003 : Error spawning 'C:\windows\system32\cmd.exe'.
The Properties | Compatibility tab is greyed out, so switching this off seems impossible (Compatibility modes cannot be set on this program because it is part of this version of Windows).
To recover from this situation you have to edit the registry to remove the RUNASADMIN preferences that is associated with cmd.exe.
The 'RUNASADMIN' preference is stored in these registry keys:
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
Delete the values named c:\windows\system32\cmd.exe and you are back in business !
Kees
Right click on the cmd.exe, select properties and check the compatibility tab. Is the Run this program as an administrator checkbox checked?
This is only happening because you're logged in as a user with administrative privileges.
Since doing so defeats the entire Windows security model, you shouldn't be doing that in the first place. Create a standard user account and log in with that, instead. The command prompt should then not open with administrative privileges since you don't have administrative privileges.
If, as a standard user, you need to open a command prompt with administrative privileges, you'll need to right-click on the shortcut and select the "Run as Administrator" option (just look for the UAC shield). You'll need to provide sufficient credentials to authenticate yourself as an administrator, and then you'll have the authority to wreak whatever havoc you wish.
Found a way to run as a specific user even when UAC is turned off from http://www.sevenforums.com/general-discussion/235987-run-cmd-exe-given-user-administrator-command-line.html
This is the way to start cmd.exe as any user. Replace "username" with the correct one:
cmd.exe> runas /user:username "cmd.exe"
Right click on the cmd shortcut, navigate to properties, select advanced options and uncheck the 'Run as admin' option.
Check this video for better understanding - https://www.youtube.com/watch?v=3Mxh5TNSIl8&list=PLg8CURsOKswrzPs9fMhnmdy9TP7AkOOX1&index=1

Resources