casper scripts and multiline strings

icejoran
New Contributor

Hi fellow JAMF users,

I'm using bash scripts to prep a certain user environment.
In order to automate some processes i need to drop a predefined ssh public and private key in this .ssh directory.

The way i'm doing this is via a multiline string in bash as in this example,
cat << SSH > /Users/uncle_john/.ssh/id_rsa
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAow4l+C6+dIPDbV/OQvQYNKjrfEMwVo7UE8pl4w8RPrGs5e50
N4ZIDYdJZtIX8POJ774TxKM047CxfssHi+c1sIMxvETIuVxMq5vuisdWA4JR50qD
4Rn3nI5lvkpgh8gycRVxVVPqmTYpe/9fZWkX8Hee5Pl0YtTqh6OlcGv0XzXUIH+H
...
-----END RSA PRIVATE KEY-----
SSH

In a usual bash script this works perfectly fine, but the casper imaging procedure leaves me with an empty file.
Also the content of the script which generates the content is empty.
So i have the feeling some unexpected interpretation is done by the casper suite.

It would help me a lot if someone could point out some hints.

Many thanks

1 REPLY 1

calumhunter
Valued Contributor

could you not create a package/dmg with the private key file on it and then deploy that?

also can you post the entire script your trying to run? from shebang to end of file and use the script tag's for easier reading/formating.

How are you running the script? does it exist in the JSS and then running it via a policy?